Using DATA Step Approaches to Identify and Count Missing Values

Counting missing values is not usually enough. If you have variables for which missing values are not allowed, you need to locate the observations so that the original data values can be checked and the errors corrected. A simple DATA step with a PUT statement is one approach. Program 3-2 checks for any missing visit dates, heart rates (HR), or adverse events (AE).

Program 3-2. Writing a Simple DATA Step to List Missing Data Values and an ID Variable
DATA _NULL_; INFILE "C:\CLEANING\PATIENTS.TXT" PAD; FILE PRINT; ***Send output to the Output window; TITLE "Listing of Missing Values"; ***Note: We will only input those variables of interest; INPUT @1 PATNO $3. @5 VISIT MMDDYY10. @15 ...

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.