PROC COMPARE generates the following
information about the two data sets that are being compared:
-
whether matching variables have
different values
-
whether one data set has more observations
than the other
-
what variables the two data sets
have in common
-
how many variables are in one data
set but not in the other
-
whether matching variables have
different formats, labels, or types
-
a comparison of the values of matching
observations
Further, PROC COMPARE
creates two kinds of output data sets that give detailed information
about the differences between observations of variables that it is
comparing.
The following example
compares the data sets PROCLIB.ONE and PROCLIB.TWO, which contain
similar data about students:
data proclib.one(label='First Data Set');
input student year $ state $ gr1 gr2;
label year='Year of Birth';
format gr1 4.1;
datalines;
1000 1970 NC 85 87
1042 1971 MD 92 92
1095 1969 PA 78 72
1187 1970 MA 87 94
;
data proclib.two(label='Second Data Set');
input student $ year $ state $ gr1
gr2 major $;
label state='Home State';
format gr1 5.2;
datalines;
1000 1970 NC 84 87 Math
1042 1971 MA 92 92 History
1095 1969 PA 79 73 Physics
1187 1970 MD 87 74 Dance
1204 1971 NC 82 96 French
;