Help using Base SAS procedures

Proc compare showing matching values even after using OUTNOEQUAL Option

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Proc compare showing matching values even after using OUTNOEQUAL Option

Hi,

 

I am trying to test two datasets to make sure both are same. I am using OUTNOEQUAL option to not report the matching values in the output. But somehow its still showing up. Any leads?

 

Attached is the outuput i am getting.

 

Regards,

 


Accepted Solutions
Solution
‎11-15-2017 02:38 AM
Super User
Super User
Posts: 9,599

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Posted in reply to Sunboyss30

This is because of the way numbers are stored on the machine.  What you are seeing is one or the other (or possibly both) have a tiny fraction, for example:
123.0000000000000001

versus

123.00

 

You don't necessarily see this directly in the dataset and is usually the result of mathematical operations where the result is not rounded/processed properly.

 

Try fuzz=

as given in this post:

https://communities.sas.com/t5/SAS-Procedures/Proc-compare-numeric-decimal-rounding-up-in-the-Base-d...

 

And if your interested in it the full explanation:

http://documentation.sas.com/?docsetId=lrcon&docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&docsetVer...

View solution in original post


All Replies
PROC Star
Posts: 1,259

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Posted in reply to Sunboyss30

if you simply want to test if two data sets are exactly the same, then use PROC COMPARE and the generated &sysinfo. macro variable. The value of &sysinfo. will be zero for matching data sets.

Occasional Contributor
Posts: 8

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Thanks for your inputs.

Solution
‎11-15-2017 02:38 AM
Super User
Super User
Posts: 9,599

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Posted in reply to Sunboyss30

This is because of the way numbers are stored on the machine.  What you are seeing is one or the other (or possibly both) have a tiny fraction, for example:
123.0000000000000001

versus

123.00

 

You don't necessarily see this directly in the dataset and is usually the result of mathematical operations where the result is not rounded/processed properly.

 

Try fuzz=

as given in this post:

https://communities.sas.com/t5/SAS-Procedures/Proc-compare-numeric-decimal-rounding-up-in-the-Base-d...

 

And if your interested in it the full explanation:

http://documentation.sas.com/?docsetId=lrcon&docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&docsetVer...

Occasional Contributor
Posts: 8

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Thanks a lot RW9. it worked perfectly.

 

Many thanks again !

Occasional Contributor
Posts: 8

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Hi,

 

Also to check for Date values. I have two variables defined as Date9. and Datetime20. which obviously give difference. But is there any way to match these. Do i need to convert the format of any of the variable to match it. Or any option in Proc compare is there?

 

Please suggest.

 

Regards,

Super User
Super User
Posts: 9,599

Re: Proc compare showing matching values even after using OUTNOEQUAL Option

Posted in reply to Sunboyss30

Its a good idea to start a new thread for new questions

http://documentation.sas.com/?docsetId=proc&docsetTarget=p1l5iwaf47ma83n1euxxp10g8xh5.htm&docsetVers...

I don think there is an option for that.  Dates and datetimes are actually numbers, number of days or seconds since a certain point in time, hence they are very different.  You can only compare like for like.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 271 views
  • 0 likes
  • 3 in conversation