Previous Page | Next Page

The COMPARE Procedure

Example 2: Comparing Variables in Different Data Sets


Procedure features:

PROC COMPARE statement option

NOSUMMARY

VAR statement

WITH statement

Data sets:

PROCLIB.ONE, PROCLIB.TWO.


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


Program

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

Output: Listing

                 Comparison of Variables in Different Data Sets                1

                               COMPARE Procedure
                   Comparison of PROCLIB.ONE with PROCLIB.TWO
                                 (Method=EXACT)

NOTE: Data set PROCLIB.TWO contains 1 observations not in PROCLIB.ONE.
NOTE: Values of the following 1 variables compare unequal: gr1^=gr2


                     Value Comparison Results for Variables

           __________________________________________________________
                      ||       Base    Compare
                  Obs ||        gr1        gr2      Diff.     % Diff
            ________  ||  _________  _________  _________  _________
                      ||
                   1  ||       85.0    87.0000     2.0000     2.3529
                   3  ||       78.0    73.0000    -5.0000    -6.4103
                   4  ||       87.0    74.0000   -13.0000   -14.9425
           __________________________________________________________

Previous Page | Next Page | Top of Page