Differences between revisions 2 and 3
Revision 2 as of 2023-01-31 16:18:46
Size: 1121
Comment:
Revision 3 as of 2023-01-31 16:18:52
Size: 1123
Comment:
Deletions are marked like this. Additions are marked like this.
Line 51: Line 51:

SAS Compare Procedure

The COMPARE procedure in SAS compares two data tables.


Syntax

proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2;
    title 'Comparing Two Data Sets';
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

SAS/Compare (last edited 2023-03-30 20:17:16 by DominicRicottone)