Help using Base SAS procedures

proc compare reporting same values as different

Occasional Contributor
Posts: 10

proc compare reporting same values as different

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!

Super User
Posts: 10,280

Re: proc compare reporting same values as different

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.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Posts: 42

Re: proc compare reporting same values as different

METHOD=relative Criterion=0.000000001;

for example. Try to use different criteria if necessary.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation