SAS: Compare two datasets

Use PROC COMPARE  to compare attributes and variable existence of two dataset at multiple levels without using Data Step.

Results

Comparison of dataset1 with dataset2

(Method=EXACT)
Data Set Summary: Compare the number of variables, varibles with different labes, and number of observations
Variables Summary: number of same variables on both datasets; number of variables in one dateset but not the other.
Listing of Common Variables with Conflicting Types:
listing of Common Variables with Different Attributes: list variables with different length, formats, informats, and labels
Observation Summary
Values Comparison summary
Variables with Unequal Values
Value Comparison Results for Variables

options
NOVALUES to compare just the meta data
BRIEF to get a concise output to omit the variables with unequal values from the output.
LISTVAR to get a listing of the variables that are unique to one dataset or the other

meta data comparison:
proc compare base = dataset1 compare = dataset2 NOVALUES LISTVAR;
run;

record level comparison:

proc sort data= dataset1;
by studentid course;
proc sort data= dataset1;
by studentid course;
proc compare base = dataset1 compare = dataset2 out=check outnoequal;
by studentid courseid;
run;

OUTNOEQUAL: suppresses the writing of observations when all values are equal.  Only show the differences.