BookmarkSubscribeRSS Feed
elwayfan446
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*/
			 base=msr.msr_master_table
			 compare=msr.msr_master_table_prevday;
by id;

run;

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

1 REPLY 1
ballardw
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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 997 views
  • 0 likes
  • 2 in conversation