Lists variables to use to
- specifies the variable that the procedure uses to match
observations. You can specify more than one variable, but the data set must
be sorted by the variable or variables you specify. These variables are ID variables. ID variables also identify observations on the printed
reports and in the output data set.
- specifies that the data set is sorted in descending order
by the variable that immediately follows the word DESCENDING in the ID statement.
If you use the DESCENDING option, you must sort the data sets. The
SAS System does not use an index to process an ID statement with the DESCENDING
option. Further, the use of DESCENDING for ID variables must correspond to
the use of the DESCENDING option in the BY statement in the PROC SORT step
that was used to sort the data sets.
- specifies that observations are not necessarily sorted in
alphabetic or numeric order. The data are grouped in another way, for example,
If you do not want to sort the data set
by the ID variables,
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, PROC COMPARE prints an error message and stops
variables must be in the BASE= data set or PROC COMPARE stops
- If an ID variable is not in the COMPARE= data set, PROC COMPARE
prints a warning to the SAS log and does not use that variable to match observations
in the comparison data set (but does write it to the OUT= data set).
- ID variables must be of the same type in both data sets.
- You should sort both
data sets by the common ID variables (within
the BY variables, if any) unless you specify the NOTSORTED option.
If the data sets are not sorted by the common ID variables and you do
not specify the NOTSORTED option, PROC COMPARE prints a warning message and
continues to process the data sets as if you had specified NOTSORTED.
The observations in each data
set should be uniquely labeled
by the values of the ID variables. If PROC COMPARE finds two successive observations
with the same ID values in a data set, it
- prints the warning
Duplicate Observations for the first
occurrence for that data set
- prints the total number of duplicate observations found in the
data set in the observation summary report
- uses the first observation with the duplicate value for the comparison.
When the data
sets are not sorted, PROC COMPARE detects only those duplicate
observations that occur in succession.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.