BookmarkSubscribeRSS Feed
ThomasH
Calcite | Level 5
Dear all,

I am facing an unexpected issue here.

There's field X (decimal 7.2) a in a DB/2 database, which contains the value 0.01.

Once I run a proc copy into a SAS dataset (also decimal 7.2), the value is changed to 0.00999...8.

Why does this happen? It does not behave like this for e.g. 100.00.

Thanks,
Thomas
1 REPLY 1
Doc_Duke
Rhodochrosite | Level 12
0.01 and 0.00999... represent the same real number.

SAS does not store decimal numbers exactly (unlike, say, COBOL). It stores all numbers as real numbers. A base-10 decimal number cannot be represented exactly in a base-2 system (integers can be represented exactly).

There are also a couple of standards for the internal structure of a real number. There is possibility that DB/2 and SAS use different standards, which could exacerbate this problem.

To really tease it out you will have to read the "fine print" in both DB/2 and SAS for numeric representation.

Doc Muhlbaier
Duke

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
  • 1 reply
  • 987 views
  • 0 likes
  • 2 in conversation