If
you do not want to sort the data set by the ID variables, then you
can use the NOTSORTED option. When you specify the NOTSORTED option,
or if the ID statement is omitted, PROC COMPARE matches the observations
one-to-one. That is, PROC COMPARE matches the first observation in
the base data set with the first observation in the comparison data
set, the second with the second, and so on. If you use NOTSORTED,
and the ID values of corresponding observations are not the same,
then PROC COMPARE prints an error message and stops processing.
If the data sets are
not sorted by the common ID variables and if you do not specify the
NOTSORTED option, then PROC COMPARE writes a warning message to the
SAS log and continues to process the data sets as if you had specified
NOTSORTED.