SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
qd96xuweifeng1
Calcite | Level 5

Hello,

 

I have encountered one problem when I am extracting a numeric variable which is with 18 digits length from database. The last two digits are truncated to 0. For example, the number of 19999999999903 is changed to 19999999999900.

 

qd96xuweifeng1_0-1668709440227.png

May I know what cause this problem? And how to solve it?

 

Thanks,

Weifeng

2 REPLIES 2
Kurt_Bremser
Super User

There is no solution. SAS datasets store numbers in 8 bytes, using the real format. This limits numbers to a precision of 15 to 16 decimal digits, which is sufficient for statistics. When dealing with the US GDP, cents are unimportant.

If this "number" is in fact some kind of code, store it as character.

AMSAS
SAS Super FREQ

Take a look at the documentation or do a search on the communities 

Numeric Precision 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

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
  • 2 replies
  • 463 views
  • 0 likes
  • 3 in conversation