Chapter Contents |
Previous |
Next |
The COMPARE Procedure |
Restriction: | If you omit COMPARE=, you must use the WITH and VAR statements. |
Restriction: | PROC COMPARE reports errors differently if one or both of the compared data sets are not RADIX addressable. Version 6 compressed files are not RADIX addressable, while, beginning with Version 7, compressed files are RADIX addressable. (The integrity of the data is not compromised; the procedure simply numbers the observations differently.) |
Reminder: | You can use data set options with the BASE= and COMPARE= options. |
PROC COMPARE <option(s)>; |
To do this | Use this option | |
---|---|---|
Specify the data sets to compare | ||
Specify the base data set | BASE= | |
Specify the comparison data set | COMPARE= | |
Control the output data set | ||
Create an output data set | OUT= | |
Write an observation for each observation in the BASE= and COMPARE= data sets | OUTALL | |
Write an observation for each observation in the BASE= data set | OUTBASE | |
Write an observation for each observation in the COMPARE= data set | OUTCOMP | |
Write an observation that contains the differences for each pair of matching observations | OUTDIF | |
Suppress the writing of observations when all values are equal | OUTNOEQUAL | |
Write an observation that contains the percent differences for each pair of matching observations | OUTPERCENT | |
Create an output data set that contains summary statistics | OUTSTATS= | |
Specify how the values are compared | ||
Specify the criterion for judging the equality of numeric values | CRITERION= | |
Specify the method for judging the equality of numeric values | METHOD= | |
Judge missing values equal to any value | NOMISSBASE and NOMISSCOMP | |
Control the details in the default report | ||
Include the values for all matching observations | ALLOBS | |
Print a table of summary statistics for all pairs of matching variables | ALLSTATS and STATS | |
Include in the report the values and differences for all matching variables | ALLVARS | |
Print only a short comparison summary | BRIEFSUMMARY | |
Change the report for numbers between 0 and 1 | FUZZ= | |
Restrict the number of differences to print | MAXPRINT= | |
Suppress the print of creation and last-modified dates | NODATE | |
Suppress all printed output | NOPRINT | |
Suppress the summary reports | NOSUMMARY | |
Suppress the value comparison results. | NOVALUES | |
Produce a complete listing of values and differences | PRINTALL | |
Print the value differences by observation, not by variable | TRANSPOSE | |
Control the listing of variables and observations | ||
List all variables and observations found in only one data set | LISTALL | |
List all variables and observations found only in the base data set | LISTBASE | |
List all observations found only in the base data set | LISTBASEOBS | |
List all variables found only in the base data set | LISTBASEVAR | |
List all variables and observations found only in the comparison data set | LISTCOMP | |
List all observations found only in the comparison data set | LISTCOMPOBS | |
List all variables found only in the comparison data set | LISTCOMPVAR | |
List variables whose values are judged equal | LISTEQUALVAR | |
List all observations found in only one data set | LISTOBS | |
List all variables found in only one data set | LISTVAR |
Options |
Default: | If you omit ALLOBS, PROC COMPARE prints values only for observations that are judged unequal. |
Interaction: | When used with the TRANSPOSE option, ALLOBS invokes the ALLVARS option and displays the values for all matching observations and variables. |
See also: | Table of Summary Statistics for information on the statistics produced |
Default: | If you omit ALLVARS, PROC COMPARE prints values only for variables that are judged unequal. |
Interaction: | When used with the TRANSPOSE option,
ALLVARS displays unequal values in context with the values for other matching
variables. If you omit the TRANSPOSE option, ALLVARS invokes the ALLOBS option and displays the values for all matching observations and variables. |
Alias: | DATA= |
Default: | the most recently created SAS data set |
Tip: | You can use the WHERE= data set option with the BASE= option to limit the observations that are available for comparison. |
Alias: | BRIEF |
Tip: | By default, a listing of value differences accompanies the summary reports. To suppress this listing, use the NOVALUES option. |
Featured in: | Comparing Variables That Are in the Same Data Set |
Aliases: | COMP=, C= |
Default: | If you omit COMPARE=, the comparison data set is the same as the base data set, and PROC COMPARE compares variables within the data set. |
Restriction: | If you omit COMPARE=, you must use the WITH statement. |
Tip: | You can use the WHERE= data set option with COMPARE= to limit the observations that are available for comparison. |
Default: | 0.00001 |
See also: | The Equality Criterion for more information |
Interaction: | This option overrides the WARNING option. |
Default | 0 |
Range: | 0 - 1 |
Tip: | A report that contains many trivial differences is easier to read in this form. |
Alias | LIST |
Interaction: | using LISTALL is equivalent to using the following four options: LISTBASEOBS, LISTCOMPOBS, LISTBASEVAR, and LISTCOMPVAR. |
Interaction: | Using LISTBASE is equivalent to using the LISTBASEOBS and LISTBASEVAR options. |
Interaction: | Using LISTCOMP is equivalent to using the LISTCOMPOBS and LISTCOMPVAR options. |
Interaction: | Using LISTOBS is equivalent to using the LISTBASEOBS and LISTCOMPOBS options. |
Interaction: | Using LISTVAR is equivalent to using both the LISTBASEVAR and LISTCOMPVAR options. |
The MAXPRINT= option prevents the output from becoming extremely large when data sets differ greatly.
Unless you use the CRITERION= option, the default method is EXACT. If you use CRITERION=, the default method is RELATIVE(), where (phi) is a small number that depends on the numerical precision of the computer on which you are running the SAS System and on the value of CRITERION=.
See also: | The Equality Criterion |
You can use this option to determine the changes that would be made to the observations in the comparison data set if it were used as the master data set and the base data set were used as the transaction data set in a DATA step UPDATE statement. For information on the UPDATE statement, see the chapter on SAS language statements in SAS Language Reference: Dictionary.
You can use this option to determine the changes that would be made to the observations in the base data set if it were used as the master data set and the comparison data set were used as the transaction data set in a DATA step UPDATE statement. For information on the UPDATE statement, see the chapter on SAS language statements in SAS Language Reference: Dictionary.
Alias: | NOMISS |
Interaction: | Using NOMISSING is equivalent to using both NOMISSBASE and NOMISSCOMP. |
Tip: | You may want to use this option when you are creating one or more output data sets. |
Featured in: | Comparing Values of Observations Using an Output Data Set (OUT=) |
Tips: | NOSUMMARY produces no output if there are no differences in the matching values. |
Featured in: | Comparing Variables in Different Data Sets |
Featured in: | Overview |
See also: | Output Data Set (OUT=) |
Featured in: | Comparing Values of Observations Using an Output Data Set (OUT=) |
Tip: | Using OUTALL is equivalent to using the following four options: OUTBASE, OUTCOMP, OUTDIF, and OUTPERCENT. |
See also: | Output Data Set (OUT=) |
See also: | Output Data Set (OUT=) |
Featured in: | Comparing Values of Observations Using an Output Data Set (OUT=) |
See also: | Output Data Set (OUT=) |
Featured in: | Comparing Values of Observations Using an Output Data Set (OUT=) |
Default: | The OUTDIF option is the default unless you specify the OUTBASE, OUTCOMP, or OUTPERCENT option. If you use any of these options, you must explicitly specify the OUTDIF option to create _TYPE_=DIF observations in the output data set. |
See also: | Output Data Set (OUT=) |
Featured in: | Comparing Values of Observations Using an Output Data Set (OUT=) |
See also: | Output Data Set (OUT=) |
Featured in: | Comparing Values of Observations Using an Output Data Set (OUT=) |
See also: | Output Data Set (OUT=) |
Tip: | If you want to print a table of statistics in the procedure output, use the STATS, ALLSTATS, or PRINTALL option. |
See also: | Output Statistics Data Set (OUTSTATS=) and Table of Summary Statistics . |
Featured in: | Creating an Output Data Set of Statistics (OUTSTATS=) |
Featured in: | Producing a Complete Report of the Differences |
See also: | Table of Summary Statistics for information on the statistics produced. |
Interaction: | If you also use the NOVALUES option, the TRANSPOSE option lists only the names of the variables whose values compare as unequal for each observation, not the values and differences. |
See also: | Comparison Results for Observations (Using the TRANSPOSE Option) . |
Interaction: | The ERROR option overrides the WARNING option. |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.