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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 597 views
  • 0 likes
  • 2 in conversation