06-26-2014 05:25 PM
I'm a relatively new SAS user. I'm trying to write a data step for the following condition:
I have 2 data sets. One contains old items. The other new items. I need to create a file that show the items on the new file that are not on the old file.
What is the best way to go about this?
06-26-2014 05:34 PM
But a data step merge works as well, assuming you have some matching_key that is the product identifier then something like the following will work.
The key is the IN Data Set Option.
merge new (in=newFile)
if newFile and not oldFile;
06-26-2014 07:46 PM
Depending on sort order of the two. It helps if both datasets are sorted in the same order. A lot.
You should define items. Is it records or variables, or both?
Proc Compare Base=OldData Compare=NewData listcompobs ;run;
will give a list of RECORD numbers in the NewData that don't exist in the Olddataset.
Proc Compare Base=OldData Compare=NewData listcompvar ;run;
List variables in the NewData not in OldData
Proc Compare Base=OldData Compare=NewData listcomp ;run;
Does what appears in both.