SAS Day 15: Proc Compare
Problem: Suppose we need to compare the dataset Prod and QC.
We use Proc Compare to compare the value of two datasets. The report will give us the summary of two dataset. Proc compare has many options, the ones I like the most are: Criterion, Var…. With, Listall, Id, Out.
Criterion: Set the compare decimal places.
Var…With: Compare the attributes with different names.
E.g. Var aval; With aval1;
Listall: List all the comparison results.
Id: Specify the compared order.
E.g: Id usubjid visitnum visdtc;
Out: Output a dataset for compared results.
Proc Compare Base=a Compare=b listall criterion=0.0001; var x y z; with a b c; run;
Obviously, Prod and QC dataset did not match. So we need to go back and digging what caused the discrepancies and fix it!
Happy SAS Coding! ☺