Did you know that ?
- The maximum number of variables in a single SAS data set under Windows is 32,767.
- An observation under Windows cannot be longer than 5MB(ie 5*1024*1024).
- Therefore, if you want your data set to contain 32,767 character variables, the longest each variable can be is approximately 160 bytes.
- However, a DATA step can reference more than 32,767 variables, if you write only 32,767 or fewer variables to the data set. For example, you could drop some variables with a DROP= data set option. The maximum number of variables a DATA step can reference under Windows is 2,147,483,647.
- The default length of numeric variables in SAS data sets is 8 bytes. (You can control the length of SAS numeric variables with the LENGTH statement in the DATA step.) In SAS under Windows, the Windows data type of numeric values that have a length of 8 is LONG REAL. The precision of floating-point values is always accurate to 15 digits. Depending upon the number, the precision may be 16 digits of accuracy.
Significant Digits and Largest Integer by Length for SAS Variables under Windows
Length in Bytes | Largest Integer Represented Exactly | Exponential Notation | Significant Digits Retained |
---|---|---|---|
3 | 8,192 | 213 | 3 |
4 | 2,097,152 | 221 | 6 |
5 | 536,870,912 | 229 | 8 |
6 | 137,438,953,472 | 237 | 11 |
7 | 35,184,372,088,832 | 245 | 13 |
8 | 9,007,199,254,740,992 | 253 | 15 |
This maximum number varies for every Operating System…
72057594037927936 – os/390 IBM Mainframes
9007199254740991 – OpenVMS
9007199254740992 – Windows / Unix
9007199254740991 – OpenVMS
9007199254740992 – Windows / Unix
For example, if you know that a numeric variable always has values between 0 and 100, you can use a length of 3 to store the number and thus save space in your data set.
Here is an example:
Trying out numbers greater than max number for len 8 in the above table to see the results….employed best32. format.
data numbers; |
input x; |
format x best32.; |
cards; |
9007199254740992 |
9007199254740999 |
90071992547409921 |
9007199254740992123 |
; |
run; |
Look at the output for obs 3 & 4…The values are getting rounded off to the next number with trailing zeroes…
Note: Dummy variables (those whose only purpose is to hold 0 or 1) can be stored in a variable whose length is 3 bytes.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.