Please read post before replying.
I was cleaning a SAS dataset of laboratory values when I found hidden values in a numeric variable. FASTGLU is a numeric value with a format of BEST12. After I initially attempted to remove all missing values (if FASTGLU^=.;), I found there were still missing values left in the dataset when I ran proc means. After removing all of the valid values, I found these remaining missings values via the table editor, they appeared as "T"s (and one "U"). I double checked that FASTGLU is a numeric variable. I tried to run proc freq and proc means on these values, but the values behave as missings. I tried removing the variable format (by proc databases) to see if there is a certain value associated with "T" or "U" (no luck). I used the SAS export wizard to export the data to Excel to find the values. When exported, FASTGLU is a column of blank cells. The column label for FASTGLU is "Fasting serum glucose (mg/dL, .T if not fasting)" , so it's a programming trick with limited use. I can visually see from FASTGLU=T that there should be a nonfasting glucose available but I can't program "if FASTGLU=T then GLUCOSE=NONFASTGLU" because SAS recognizes FASTGLU=T as a missing value. I'm just curious about this situation.
Here's my code:
proc datasets lib=work noprint;
modify GluCheck;
attrib _all_ label=' ';
attrib _all_ format=;
run;
proc means data=GluCheck noprint; /*Get Min/Max of Valid Values*/
var FASTGLU;
output out=GluStat (drop=_TYPE_ _FREQ_) Min=Gmin Max=Gmax;
run;
/*Add Min/Max to Glucose data*/
proc sql;
create table GluAddStat as
select * from
GluCheck, GluStat;
quit;
data JustGlu (drop=Gmin Gmax);
set GluAddStat (where=(if FASTGLU^=. )); /*drop missing values*/;
if (FASTGLU < Gmin or FASTGLU > Gmax); /*drop values between min and max*/
run;
proc means data=JustGlu n mean min max nmiss;
var FASTGLU;
title 'FASTGLU - Remaining Missing Values';
run;
proc freq data=JustGlu;
tables FASTGLU;
title 'FASTGLU - Remaining Missing Values';
run;
... View more