I've two datasets (OLD & NEW) to compare and create an incremental report of New and Updated records (ie., difference between the two data). Also need to flag those records in a new variable as noted below.
New or Updated data can be:
1) a new record added where the subject is NEW (should be flaged as NN).
2) a new record added to an existing subject (flaged as NE).
3) a record modified (data correction) to an existing subject (MD).
OLD file (plz copy and paste to .XLS and create a SAS dataset. First row includes the variables)
In the NEW file, I've added
2 new records where the subjects are NEW (1_00011 & 1_00012)
1 new record to an existing subject (1_00009).
1 record modified (data correction) to an existing subject (1_00008).
Hence the incremental data should have only 4 records with the following flags in a new variable:
2 NN, 1NE, 1MD
I will offer you some suggestions for SAS coding - surely you are looking for guidance and not just someone to do your work, right?
One approach is code up a DATA step to read the two inputs, creating SAS files, then sort the data, and use PROC COMPARE to generate an output with differences, and you should have the desired results, I would say.
The SAS product documentation is hosted at the SAS support website http://support.sas.com/ and you will also find many additional technical papers on various SAS programming topics at the site.