COMPARE Procedure

Example 2: Comparing Variables in Different Data Sets

Features:

PROC COMPARE statement option: NOSUMMARY

VAR statement

WITH statement

Data set: PROCLIB.ONE, PROCLIB.TWO

Details

This example compares a variable from the base data set with a variable in the comparison data set. All summary reports are suppressed.

Program

libname proclib 'SAS-library';
options nodate pageno=1 linesize=80 pagesize=40;
proc compare base=proclib.one compare=proclib.two nosummary;
   var gr1;
   with gr2;
   title 'Comparison of Variables in Different Data Sets';
run;

Program Description

Declare the PROCLIB SAS library.
libname proclib 'SAS-library';
Set the SAS system options. The NODATE option suppresses the display of the date and time in the output. PAGENO= specifies the starting page number. LINESIZE= specifies the output line length, and PAGESIZE= specifies the number of lines on an output page.
options nodate pageno=1 linesize=80 pagesize=40;
Suppress all summary reports of the differences between two data sets. BASE= specifies the base data set and COMPARE= specifies the comparison data set. NOSUMMARY suppresses all summary reports.
proc compare base=proclib.one compare=proclib.two nosummary;
Specify one variable from the base data set to compare with one variable from the comparison data set. The VAR and WITH statements specify the variables to compare. This example compares GR1 from the base data set with GR2 from the comparison data set.
   var gr1;
   with gr2;
   title 'Comparison of Variables in Different Data Sets';
run;

Output: HTML

Comparison of Variables in Different Data Sets