Help using Base SAS procedures

Arithmetic Precision

Reply
Super Contributor
Posts: 358

Arithmetic Precision

Hi All:

We are in the midst of converting from SAS 9.1 to SAS 9.3.  As part of the process we are running sample programs on both systems

with the same data and comparing the results.  All the results are in SAS tables.

In one such test there were some errors in the figures where the difference is very small - in the order of 1.3E-13.  I know that these

values would affect the outcome because the figures are dollars and cents, but I'm wondering why there is a difference in the first

place?  Is this something with version of SAS or perhaps I need to change a option?

I one such case I have over 2 million records in each table and only 1 record is unequal and the difference is -1.31E-14.

Thanks in advance.

Trusted Advisor
Posts: 2,113

Re: Arithmetic Precision

Perhaps reviewing these two documents will resolve it for you

https://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_913/base_lrconcept_9196.pdf

SAS(R) 9.3 Language Reference: Concepts, Second Edition

E-13 is in the range where the floating point processor can produce random errors.

Super User
Posts: 3,105

Re: Arithmetic Precision

If you are using PROC COMPARE to confirm if two SAS tables are the same or not, when you use METHOD = EXACT it is likely to report the very small floating point differences you are seeing. Try METHOD = ABSOLUTE instead and SAS will ignore differences in the precision range.

Super Contributor
Posts: 358

Re: Arithmetic Precision

SASWiki:

Using METHOD=ABSOLUTE resulted in the same error, but METHOD=RELATIVE passed the record.  Seems that the

field in error is 3.72E12 and has a difference of .000488 between files.  This is above the CRITERION value of .00001 so

that is why the fields are different.

I must add that the 2 tables were created on 2 different machines running 2 different versions of SAS with different

bitness (on x32 the other x64).  I think this contributes to the why some random numbers are a little out of sync.

Thanks.

Super User
Posts: 3,105

Re: Arithmetic Precision

METHOD = ABSOLUTE works for me but I am comparing within the same operating system and my differences are 1E-14 and smaller. Tweeking the CRITERION should give you what you require if you want to avoid reporting "large small differences".

Ask a Question
Discussion stats
  • 4 replies
  • 194 views
  • 3 likes
  • 3 in conversation