SAS Compare

A procedure for comparing two datasets.


Usage

To compare two datasets, try:

proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2;
run;


Examples

Basic Usage

proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2 printall;
    title 'Comparing Two Data Sets: Complete Report';
run;

Comparing Cases

To compare data on a case-by-case basic, identify an ID variable.

proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2;
    id ID;
    title 'Comparing Two Data Sets: By IDs';
run;

To show the differences by row, use the transpose option.

Identify Missing Data

Use the listbase option to list all variables and observations found only in the base table. Or use the listbasevar and listbaseobs options to show only one or the other.

Use the listcomp option to do the same for the compare table. Similarly, there are listcompvar and listcompobs options.


CategoryRicottone