College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

SAS FAQ #8: Catching data entry errors with SAS

Question:

How can I use SAS to check for data entry errors?

Answer:

PROC COMPARE compares two SAS datasets with each other. It warns you if it detects observations (rows) or variables (columns) that do not agree across the two datasets. When there are no disagreements, you can be confident that data entry is reliable. To use PROC COMPARE, enter your data twice, once each into two separate raw data files. Then use the two raw data files to create two SAS data sets. Then use PROC COMPARE. The following example compares the two SAS data sets named FRED and SAM.

PROC COMPARE BASE = fred COMPARE = sam ERROR ;
ID subjctid ;

The BASE keyword defines the data set that SAS will use as a basis for comparison. The keyword COMPARE defines the dataset which SAS will compare with the base dataset. The ERROR keyword requests that SAS print an error message to the SASLOG file if it discovers any differences when it compares the two data sets.

The ID statement tells SAS to compare rows (observations) in the data set by the identifying variable, which here is named SUBJCTID. This variable must have a unique value for each case.

PROC COMPARE features a number of options, many of which are designed to control the amount and type of information displayed in the listing file.

For more information, click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation.

If you have further questions, send E-mail to stats@ssc.utexas.edu.