BookmarkSubscribeRSS Feed
pavank
Quartz | Level 8
data digits_split;
infile datalines missover;
length digits 255;
input digits ;
datalines;
1234567899999999999999999999999999999999
5547
3324
120
1005
11
2
;
run;

Hi Experts,

can you please explain variable length 3-8 even if I have given explicit length for digits variable how to get complete digits without convert numeric to char  and what is max numeric length in SAS 

3 REPLIES 3
Kurt_Bremser
Super User

SAS numbers are always stored in 8 bytes floating point. For storage in datasets, this length can be reduced down to 3 bytes, but during processing it's always 8.

The maximum precision because of this is between 15 and 16 decimal digits, which is sufficient for all kinds of statistical analysis.

Anything which needs more precision is most likely not a number, but some kind of a code and must be stored as character.

ChrisNZ
Tourmaline | Level 20

Also to note:

 

1.

SAS numbers are always stored in 8 bytes floating point

Not only SAS, that's true for numbers in software running on PC or unix.

 

2.

can you please explain variable length 3-8

The length of 8 represents the number of bytes used to store the number (sign, mantissa and exponent), not the number of digits.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1034 views
  • 2 likes
  • 3 in conversation