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 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 607 views
  • 0 likes
  • 3 in conversation