Interview Questions

PROC FORMAT

Checking Ranges for Numeric Variables

In this example you provide two informats for two numeric variables.These informats set values outside of the normal range for the variables equal to missing values. Here is the code:

Example

PROC FORMAT;
INVALUE SBPFMT 40 - 300=_SAME_
OTHER = .;
INVALUE DBPFMT 10 - 150=SAME_
OTHER =.;
RUN;
DATA FORMAT8;
INPUT $1 ID $3.
£4 SBP SBPFMT3,
@7 DBP DBPFMT3.;
DATALINES;
001160090
002310220
003020008
004 080
005150070
;
PROC PRINT DATA=FORMAT8;
RUN;

You create two informats,one for SBP (systolic blood pressure — the larger of the two numbers in a blood pressure reading, e.g. the 120 in 120/80) and one for DBP (diastolic blood pressure — the lower of the two numbers).SBP values below 40 or above 300 are set equal to missing (.), as are DBP values below 10 or above 150. Here is the PROC PRINT output from this code.

Output from Example - Checking Ranges for Numeric Variables

Notice that the out-of-range values are all set to missing values.


Pragna Meter
Next Chapter  
e-University Search
Related Jobs