BookmarkSubscribeRSS Feed
Barite | Level 11

I am trying to determine the best way compare 2 different data sets so I can pull totals from the differences.  In researching PROC COMPARE, this looks promising but it doesn't seem to work quite right for what I am looking for.


The main data set stores all information for loan records (balances, dates, etc.).  The comparison data set will be a data set that is updated each day with either new observations that are not in the master data set or observations which exist but have data points that have changed.  My goal is to be able to run a query to determine the differences between the 2 sets.  I will be looking for differences in loan count (i.e. there are 2 observations that are in the compare data set that are not in the main data set created the previous day) and balances (balances which may have been updated from the previous days data set).  I have tried the following code but the results just don't look right.  First of all, I am getting records that appear to have obersvations that all equal each other even though I am using the outnoequal option.  Next, new observations that are in the comparison data set that are not in the base data set are not showing up as differences.  I need to be able to see those new observations.


Here is the script I am running. 


proc compare out=msr.msr_daily_diff outnoequal outbase outcomp outdif /*noprint*/
by id;


I hope this is enough information.  The results have proprietary data in them so I can't post them here.

Super User

I think that you might be better off combining the two sets, adding a variable to indicate the source and then use a reporting procedure such as Proc Report to request statistics grouped by that source variable.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation