程序代写代做代考 MET MA 603: SAS Programming and Applications

MET MA 603: SAS Programming and Applications

MET MA 603:
SAS Programming and Applications

Understanding ‘09’x

1

1

What is ‘09’x ?
Why does ’09’x correspond to TAB? The answer, of course, is that ‘09’x is the hexadecimal ASCII code representation of TAB.

?????

In order to understand this definition we need to know what is meant by hexadecimal and by ASCII.

2

2

Hexadecimal
Hexadecimal is a numbering system that uses a base of 16 (most of the time we use a base of 10).
In computing, it is common to use a base of 2 (i.e., binary), where each number is represented by 1’s and 0’s.
In hexadecimal, 0 to 9 represent the same numbers as they do in base 10, while the numbers from 10 to 15 are represented with the letters A-F.
For example, the number 33 in base 10 would be represented as 21 in hexadecimal (2 x 161 + 1 x 160). The number 1514 in base 10 corresponds to 5EA in hexadecimal (5 x 162 + 14 x 161 + 10 x 160).

3

3

ASCII
ASCII stands for the “American Standard Code for Information Interchange”. It’s a system, often used in computing, for representing characters with code.
Note that the concept of ASCII is similar to Morse code, which represents the letters of the alphabet with dots and dashes.
For example, the ASCII code for the letter A is 65. In hexadecimal, this corresponds to 41.

4

4

ASCII Table
The table below shows some of the ASCII codes for different characters in base 10 and in base 16 (Hex).

5

5

Back to ‘09’x
As seen in the table on the previous slide, 09 is the ASCII representation of TAB, both in base 10 and in base 16.
SAS uses hexadecimal ASCII to represent each character. When we use the syntax ‘09’x we are telling SAS that we want to use the symbol that is represented by the ASCII code 09 in the hexadecimal system (indicated by the x).
Note that for most purposes, the single and double quotes have the same function in SAS. In this case, “09”x will produce the same result as ‘09’x.
To test your understanding: one of the examples in the code for lesson 007 imports the file city_populations7.txt using DLM=“-”. Can you modify your code so that it uses the ASCII code for dash instead?

6

6

Readings

http://ascii.cl/

7

7

/docProps/thumbnail.jpeg

Leave a Reply

Your email address will not be published. Required fields are marked *