BookmarkSubscribeRSS Feed
sAura
Fluorite | Level 6

I am running proc compare on two datasets which are excatly same, but it is still reporting mismatches.

 

seems something like the difference is due to format difference in both the dataset.

 

Obs      ||   Base          Compare       Diff.            % Diff
______|| _________ _________ _________ _________
            ||
99        || 1.5714        1.5714         -2.22E-16    -1.41E-14
100      || 1.5714        1.5714         -2.22E-16    -1.41E-14
107      || 1.5714        1.5714         -2.22E-16    -1.41E-14

 

how can i solve this is issue as i need to report that both the datasets are exactly same, hence cant use the option,

"  method=absolute  "

 

Please help!

3 REPLIES 3
Kurt_Bremser
Super User

These differences are artifacts of the way SAS store numbers.

Numerical Accuracy in SAS is a good starter.

 

If you moved a dataset from z/OS to another platform, the internal format of the 8-byte real number changes slightly (less bits in the mantissa, more in the exponent). When fractions are present, the inaccuracy inherent in the real number format is increased, and that causes the differences.

Use a proper round() function to cut off the unimportant digits before comparing.

 

I had to deal with that effect when moving old data originating from DB/2 on z/OS to a UNIX environment. Back then, DB/2 used timestamps with 6 digits after the comma as primary keys. After the transfer, exactly half of the keys did not match those keys that were newly imported from unload files on UNIX, indicating a one-bit accuracy loss.

chrej5am
Quartz | Level 8

METHOD=relative Criterion=0.000000001;

for example. Try to use different criteria if necessary.

DrAbhijeetSafai
Pyrite | Level 9

@chrej5am 

Thanks!

 

Method = relative option in proc compare statement helped me. Thanks once again.

 

Thank you.

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Associate Data Analyst
Actu-Real

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 2097 views
  • 1 like
  • 4 in conversation