|
Technical Report #10: Counting Missing Values for Any Variable Bruce Ratner, Ph.D. The problem of missing values is well known to data analysts. And, it is always important to have a count of the missing values for variables under consideration. The SAS-code program, below, provides a quick way to determine the missingness for either a numeric or character variable of concern. DATA IN; input ID 2. GENDER $1. AGE 2.; cards; 01M25 02M35 03M 04 05F54 08F53 07F 08 54 09 S 10MD ; RUN: DATA OUT: set IN END=END; if MISSING(GENDER) then NO_OF_MISSSING_VALUES_GENDER + 1; if MISSING(AGE) then NO_OF_MISSSING_VALUES_AGE + 1; if end then output; keep NO_OF_MISSSING_VALUES_gender NO_OF_MISSSING_VALUES_AGE; RUN; PROC PRINT DATA=OUT NOOBS; RUN; 1 800 DM STAT-1, or e-mail at br@dmstat1.com. |
|