A simple DATA _NULL_ step can also be used to produce a report on out-of-range values. The approach here is the same as the one described in the section of Chapter 1 that begins on page 6.
DATA _NULL_; INFILE "C:CLEANINGPATIENTS.TXT" PAD; FILE PRINT; ***Send output to the Output window; TITLE "Listing of Patient Numbers and Invalid Data Values"; ***Note: We will only input those variables of interest; INPUT @1 PATNO $3. @15 HR 3. @18 SBP 3. @21 DBP 3.; ***Check HR; IF (HR LT 40 AND HR NE .) OR HR GT 100 THEN PUT PATNO= HR=; ***Check SBP; IF (SBP LT 80 AND SBP NE .) OR SBP GT 200 THEN PUT PATNO= SBP=; ***Check DBP; IF (DBP LT 60 AND DBP NE .) OR DBP GT 120 THEN PUT PATNO= DBP=; RUN; |
Here is the output from Program 2-6.
Listing of Patient Numbers and Invalid Data Values PATNO=004 HR=101 PATNO=008 HR=210 PATNO=009 SBP=240 PATNO=009 DBP=180 PATNO=010 SBP=40 PATNO=011 SBP=300 PATNO=011 DBP=20 PATNO=014 HR=22 PATNO=017 HR=208 PATNO=321 HR=900 PATNO=321 SBP=400 PATNO=321 DBP=200 PATNO=020 HR=10 PATNO=020 SBP=20 PATNO=020 DBP=8 PATNO=023 HR=22 PATNO=023 SBP=34 |
Notice that a statement such as “IF HR LT 40” includes missing values because missing values are interpreted by SAS programs as the smallest possible value. Therefore, the following statement
IF HR LT 40 OR HR GT 100 THEN PUT PATNO= HR=;
will produce a listing that includes missing heart rates as well as out-of-range values (which may be what you want).
3.135.187.106