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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 608 views
  • 0 likes
  • 2 in conversation