COMPARE Procedure

Example 3: Comparing a Variable Multiple Times

Features:

VAR statement

WITH statement

Data set: PROCLIB.ONE, PROCLIB.TWO

Details

This example compares one variable from the base data set with two variables in the comparison data set.

Program

libname proclib 'SAS-library';
options nodate pageno=1 linesize=80 pagesize=40;
proc compare base=proclib.one compare=proclib.two nosummary;
   var gr1 gr1;
   with gr1 gr2;
   title 'Comparison of One Variable with Two Variables';
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 two variables 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 GR1 and GR2 from the comparison data set.
   var gr1 gr1;
   with gr1 gr2;
   title 'Comparison of One Variable with Two Variables';
run;

Output: HTML

The Value Comparison Results section shows the result of the comparison.
Comparison of One Variable with Two Variables