MISSING Function

Returns a numeric result that indicates whether the argument contains a missing value.

Categories: Descriptive Statistics
Character
Restriction: I18N Level 2 functions are designed for use with SBCS, DBCS, and MBCS (UTF8).

Syntax

Required Arguments

numeric-expression

specifies a numeric constant, variable, or expression.

character-expression

specifies a character constant, variable, or expression.

Details

  • The MISSING function checks a numeric or character expression for a missing value, and returns a numeric result. If the argument does not contain a missing value, SAS returns a value of 0. If the argument contains a missing value, SAS returns a value of 1.
  • A numeric expression is considered missing if it evaluates to a numeric missing value: ., ._, .A, ..., .Z.
  • A character expression is considered missing if it evaluates to a string that contains all blanks or has a length of zero.

Comparisons

The MISSING function can have only one argument. The CMISS function can have multiple arguments and returns a count of the missing values. The NMISS function requires numeric arguments and returns the number of missing values in the list of arguments.

Example

This example uses the MISSING function to check whether the input variables contain missing values.
data values;
   input @1 var1 3. @5 var2 3.;
   if missing(var1) then
      do;
         put 'Variable 1 is Missing.';
      end;
   else if missing(var2) then
      do;
         put 'Variable 2 is Missing.';
      end;
   datalines;
127
988 195
;
run;
SAS writes the following output to the log:
Variable 2 is Missing.

See Also

CALL Routines: