Desktop productivity for business analysts and programmers

Proc compare output

Posts: 29

Proc compare output

Hi everyone,


I'd like to compare two data sets for a time overlap period to see if they yield the same results. Where the data is not equal I'd like there to be an output column that indicates so with a flag i.e 0 = matching and 1 = no match.  I'd also like another column for the reason they are not matching.


Note: I CANNOT share my data. I know this makes it hard, I'm hoping it does not make it impossible Smiley Happy


Currently my code is:


proc compare base=data1 compare=data2out=comparison LISTOBS;
by x1 x2 x3;
ID x1 x2 x3;

Any help is appreciated.



Super User
Posts: 23,776

Re: Proc compare output

I don’t think PROC COMPARE will work. You need a merge or join, so a manual comparison. 

We never need your actual data, just data that’s representative. 

Super User
Super User
Posts: 9,599

Re: Proc compare output

Who is asking you to share your data?  Post test data in the form of a datastep and use the {i} code window.  Test data can be anything and only needs to be a couple of rows to demonstrate.  You will also need to show what you want out as "I'd also like another column for the reason they are not matching." doesn't give any indications.

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