Return to Archive

SAS Tip of the Month
November 2007

Sometimes we want to know if a variable is missing or blank and carry out some action based on that condition – enter stage right the MISSING function. The MISSING function returns a 1 (true) or 0 (false) if a numeric or character string is missing or blank. The following code demonstrates its use:

   189 data _null_;
   190 length string1 string2 $30;
   191 string1='THE COW JUMPED OVER THE MOON';
   192 string2=' ';
   193 missing1=missing(string1);
   194 missing2=missing(string2);
   195 put missing1= string1= /
   196 missing2= string2=;
   197 run;
   missing1=0 string1=THE COW JUMPED OVER THE MOON
   missing2=1 string2=
Updated November 1, 2007