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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 914 views
  • 0 likes
  • 2 in conversation