02-15-2013 02:57 PM
I am sort of a novice SAS user. I was wondering what would be the best way to compare the two tables and only output if there were differences in the data from the two table. I tried using the below code but due to my tables having multiple variables that need to be checked. The sort by one variable is not producing the intended results.
MERGE OT_2_new (IN=T1) OT_2_old (IN=T2);
IF T1 AND NOT T2 THEN OUTPUT OT_2_current;
02-16-2013 02:03 AM
Another option is to use the EXCEPT set operator in Proc SQL.
Either the columns must be in the same order in both tables or you should user the CORRESPONDING keyword
You can get the unmatched records in table first using something like this (untested)
Proc SQL ;
Create table firstonly as
Select * from first
Select * from second
Then get the records in the second table not matched in the first by interchanging 'first' and 'second' in the code.
Message was edited by: Richard Carson