Previous Page | Next Page

The COMPARE Procedure

Example 3: Comparing a Variable Multiple Times


Procedure features:

VAR statement

WITH statement

Data sets:

PROCLIB.ONE, PROCLIB.TWO.


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


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 gr1;
   with gr1 gr2;
   title 'Comparison of One Variable with Two Variables';
run;

Output: Listing

 Note about figure
                 Comparison of One Variable with Two Variables                 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 2 variables compare unequal: gr1^=gr1 gr1^=gr2


                     Value Comparison Results for Variables

           __________________________________________________________
                      ||       Base    Compare
                  Obs ||        gr1        gr1      Diff.     % Diff
            ________  ||  _________  _________  _________  _________
                      ||
                   1  ||       85.0      84.00    -1.0000    -1.1765
                   3  ||       78.0      79.00     1.0000     1.2821
           __________________________________________________________


           __________________________________________________________
                      ||       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