COMPARE Procedure

Restriction: You must use the VAR statement when you use the WITH statement.
Tips: Supports the Output Delivery System. For details see Output Delivery System: Basic Concepts in SAS Output Delivery System: User's Guide.

You can use the LABEL, ATTRIB, FORMAT, and WHERE statements.

Syntax

PROC COMPARE <option(s)>;
BY <DESCENDING> variable-1
<…<DESCENDING> variable-n>
<NOTSORTED>;
ID <DESCENDING> variable-1
<…<DESCENDING> variable-n>
<NOTSORTED>;
VAR variable(s);
WITH variable(s);

Table of Procedure Tasks

Statement Task Example
PROC COMPARE Statement Compare the contents of SAS data sets, or compare two variables Ex. 1, Ex. 2, Ex. 4, Ex. 6, Ex. 7
BY Statement Produce a separate comparison for each BY group  
ID Statement Identify variables to use to match observations Ex. 5
VAR Statement Restrict the comparison to values of specific variables Ex. 2, Ex. 3, Ex. 4
WITH Statement Compare variables of different names Ex. 2, Ex. 3, Ex. 4
WITH Statement Compare two variables in the same data set Ex. 4