Validating Character Data

You can use similar techniques to validate character data. Here, the set of rules might contain a list of valid values for each character variable and instructions on how to treat missing values. To do your testing, create a new data set (TEST_CHAR) by running Program 9-5.

Program 9-5. Creating a Test Data Set for Character Validation
DATA TEST_CHAR; ***If there is a short record, set all variables to missing using the MISSOVER option in the INFILE statement. DATALINES is a special file reference that allows INFILE statement options to be used with data following a DATALINES statement, rather than an external file; INFILE DATALINES MISSOVER; LENGTH PATNO $ 3 CODE $ 2 GENDER AE $ 1; INPUT PATNO CODE GENDER AE; DATALINES; ...

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.