Hi,
I'm confused with the numerical variable's width and its maximum value?
- The following is from the book: 3 bytes -> 8192, 4 bytes -> 2097152 ...
- But in my understanding, the maximum values are: 3 bytes -> 2 ** 24 -1 = 16,777,215, 4 bytes -> 4,294,967,295 ...
So, I don't understand the logic in SAS's bytes in variable definition?
thanks
James
First, 8,192 is the maximum CONSECUTIVE integer that SAS will store as a 3-byte field. But that storage format will also hold larger values, for instance
BTW, it would also hold
Secondly, your use of the 24 bits is thinking in terms of integer storage, but SAS uses a floating point storage format, reserving
For a 12 bit mantissa, the largest consecutive integer storable would be 2**13 (=8,192).
SAS stores numbers as 64 bit floating point numbers. Think of scientific notation (3.5E13) only using base 2 instead of base 10.
So part of those 64 bits are reserved for storing the magnitude. When you restrict the storage to just 3 of the 8 bytes you do NOT have 3*8 = 24 bits left for storing the actual number.
2**13 = 8,192 so 11 of the 24 bits are used to store the magnitude.
Thanks a lot!
First, 8,192 is the maximum CONSECUTIVE integer that SAS will store as a 3-byte field. But that storage format will also hold larger values, for instance
BTW, it would also hold
Secondly, your use of the 24 bits is thinking in terms of integer storage, but SAS uses a floating point storage format, reserving
For a 12 bit mantissa, the largest consecutive integer storable would be 2**13 (=8,192).
thank you!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.