Previous Page | Next Page

The COMPARE Procedure

Example 4: Comparing Variables That Are in the Same Data Set


Procedure features:

PROC COMPARE statement options

ALLSTATS

BRIEFSUMMARY

VAR statement

WITH statement

Data set:

PROCLIB.ONE.


This example shows that PROC COMPARE can compare two variables that are in the same 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 allstats briefsummary;
 Note about code
   var gr1;
   with gr2;
   title 'Comparison of Variables in the Same Data Set';
run;

Output: Listing

                  Comparison of Variables in the Same Data Set                 1

                               COMPARE Procedure
                    Comparisons of variables in PROCLIB.ONE
                                 (Method=EXACT)

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    72.0000    -6.0000    -7.6923
                   4  ||       87.0    94.0000     7.0000     8.0460
            ________  ||  _________  _________  _________  _________
                      ||
               N      ||          4          4          4          4
              Mean    ||    85.5000    86.2500     0.7500     0.6767
              Std     ||     5.8023     9.9457     5.3774     6.5221
              Max     ||    92.0000    94.0000     7.0000     8.0460
              Min     ||    78.0000    72.0000    -6.0000    -7.6923
             StdErr   ||     2.9011     4.9728     2.6887     3.2611
               t      ||    29.4711    17.3442     0.2789     0.2075
            Prob>|t|  ||     <.0001     0.0004     0.7984     0.8489
                      ||
             Ndif     ||          3     75.000%
            DifMeans  ||      0.877%     0.870%    0.7500
             r, rsq   ||      0.898      0.807
           __________________________________________________________

Previous Page | Next Page | Top of Page