Using Informats to Check for Invalid Values

You can accomplish the same result as the previous program by using user-defined informats. Remember that informats are used to replace values as the raw data is being read in or as the second argument in an INPUT function. Following is a program very similar to Program 2-9, however this one uses informats.

Program 2-10. Using User-Defined Informats to Detect Out-of-Range Data Values
PROC FORMAT; INVALUE HR_CK 40-100, . = 9999; INVALUE SBP_CK 80-200, . = 9999; INVALUE DBP_CK 60-120, . = 9999; RUN; DATA _NULL_; INFILE "C:\CLEANING\PATIENTS.TXT" PAD; FILE PRINT; ***Send output to the Output window; TITLE "Listing of Invalid Patient Numbers and Data Values"; ***Note: We will only input those variables ...

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.