Checking for Missing Values

It’s particularly easy to use PROC SQL to check for missing values. The WHERE clause IS MISSING can be used for both character and numeric variables. The simple query shown in Program 8-7 checks the data set for all character and numeric missing values and prints out any observation that contains a missing value for one or more variables.

Program 8-7. Using SQL to List Missing Values
PROC SQL;
   SELECT *
   FROM CLEAN.PATIENTS
   WHERE PATNO   IS MISSING OR
         GENDER  IS MISSING OR
         VISIT   IS MISSING OR
         HR      IS MISSING OR
         SBP     IS MISSING OR
         DBP     IS MISSING OR
         DX      IS MISSING OR
         AE      IS MISSING;
QUIT;

The SELECT statement uses an asterisk (*) to indicate that all the variables in the data set are listed in the FROM statement.

Here is the ...

Get Cody’s Data Cleaning Techniques Using SAS® Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.