Help using Base SAS procedures

Proc Compare: Equal values showing up in differences output

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Proc Compare: Equal values showing up in differences output


Hi All,

     I have come across a strange situation where a numeric variable is zero in both the base and compare datasets, on the matching ID, and yet they are showing up in the differences output. Below is how I've set up the compare code:

proc compare  base       = work.base_ds

                        compare  = work.compare_ds

                        listobs listvar maxprint=(25,3000) ;

           ID InternalID notsorted;

           attrib       _ALL_ label=''; /*Get rid of labels, formats and informats for comparison.*/

           format     _ALL_ ;

           informat  _ALL_ ;

run;

Below is an example of the results:

_______________________________________________________________

                          ||    Base      Compare                          

  InternalID        ||    Score      Score      Diff.     % Diff      

____________ ||  _________  _________  _________  _________    

                          ||                                                

        8329          ||          0          0          0          0    

        8331          ||          0          0          0          0   

Any ideas?

Thanks,

Huey


Accepted Solutions
Solution
‎04-06-2012 04:42 PM
Respected Advisor
Posts: 3,777

Re: Proc Compare: Equal values showing up in differences output

Format SCORE with the HEX16. format.  You should see a difference perhaps in the last digit.

View solution in original post


All Replies
Solution
‎04-06-2012 04:42 PM
Respected Advisor
Posts: 3,777

Re: Proc Compare: Equal values showing up in differences output

Format SCORE with the HEX16. format.  You should see a difference perhaps in the last digit.

Super User
Posts: 10,500

Re: Proc Compare: Equal values showing up in differences output

Or try the FUZZ= option. They are probably displaying as equal because of the format an may vary by a small amount.

If your data is such that a diference such as 1e-8 is "close enough to equal" try FUZZ= 1E-8 (OR 0.00000001) or other small value.

Differences smaller than your FUZZ value will be considered equal.

Occasional Contributor
Posts: 12

Re: Proc Compare: Equal values showing up in differences output

Thanks for the input ballardw, but the "difference" still shows up when I use your fuzz factor setting, even when I use a very fuzzy factor (0.001) the "difference" still shows. : |

Occasional Contributor
Posts: 12

Re: Proc Compare: Equal values showing up in differences output

This is yielding interesting/aggrevating information. Representing the fields in HEX16. format shows that:

Base        - Score = 0000000000000000

Compare - Score =                0

So, after wondering how on earth one '0' was popping up, I finally realized that I had the MISSING='0' option set!!!

I was comparing a missing value to '0' without knowing it. The HEX format really brought that to life. Thank you.

This option was buried in my process control file, and was hard to locate. Please forgive me for wasting your time!

☑ This topic is SOLVED.

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

Discussion stats
  • 4 replies
  • 321 views
  • 0 likes
  • 3 in conversation