Checking for Invalid Values: A DATA Step Approach (Separating Invalid and Missing Values) - SAS Programming

The previous strategy might be sufficient, but most likely you would still want to differentiate between invalid data and missing data. An alternative and slightly more sophisticated approach,but one that still has to read in data and then translate them,is to keep track of invalid codes separately from the missing responses. The following code accomplishes this:

Example

DATA SCREEN5;
INPUT ID 1-3
GENDER $ 4 ... ;
IF GENDER NOT IN ('M','F','')
THEN GENDER='X';
*

In this revised code, values for GENDER that are invalid and non-missing are coded as an 'X'


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAS Programming Topics