Size: 1084
Comment:
|
← Revision 6 as of 2023-03-30 20:17:16 ⇥
Size: 898
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
A procedure for comparing two datasets. | A procedure for comparing two tables. |
Line 13: | Line 13: |
To compare two datasets, try: {{{ proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2; run; }}} ---- == Examples == === Basic Usage === |
To compare two tables, try: |
Line 32: | Line 17: |
title 'Comparing Two Data Sets: Complete Report'; | |
Line 38: | Line 22: |
=== Comparing Cases === | == Id Statement == |
Line 40: | Line 24: |
To compare data on a case-by-case basic, identify an ID variable. | To compare data on a case-by-case basic, use the '''`ID`''' statement. |
Line 45: | Line 29: |
title 'Comparing Two Data Sets: By IDs'; | |
Line 49: | Line 32: |
To show the differences by row, use the `transpose` option. | To show the differences by row, use the '''`TRANSPOSE`''' option. |
Line 53: | Line 36: |
=== Identify Missing Data === | === ListBase and ListComp Options === |
Line 55: | Line 38: |
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 '''`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. |
Line 57: | Line 40: |
Use the `listcomp` option to do the same for the compare table. Similarly, there are `listcompvar` and `listcompobs` options. | Use the '''`LISTCOMP`''' option to do the same for the compare table. Similarly, there are '''`LISTCOMPVAR`''' and '''`LISTCOMPOBS`''' options. |
SAS Compare
A procedure for comparing two tables.
Usage
To compare two tables, try:
proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2 printall; run;
Id Statement
To compare data on a case-by-case basic, use the ID statement.
proc compare base=LIBREF.TABLE1 compare=LIBREF.TABLE2; id ID; run;
To show the differences by row, use the TRANSPOSE option.
ListBase and ListComp Options
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.