SAS Institute. The Power to Know

SAS(R) 9.2 Language Reference: Concepts

Previous Page | Next Page

Missing Values

Creating Special Missing Values


Definition

special missing value

is a type of numeric missing value that enables you to represent different categories of missing data by using the letters A-Z or an underscore.


Tips

  • SAS accepts either uppercase or lowercase letters. Values are displayed and printed as uppercase.

  • If you do not begin a special numeric missing value with a period, SAS identifies it as a variable name. Therefore, to use a special numeric missing value in a SAS expression or assignment statement, you must begin the value with a period, followed by the letter or underscore, as in the following example:

    x=.d;
  • When SAS prints a special missing value, it prints only the letter or underscore.

  • When data values contain characters in numeric fields that you want SAS to interpret as special missing values, use the MISSING statement to specify those characters. For further information, see the MISSING statement in SAS Language Reference: Dictionary.


Example

The following example uses data from a marketing research company. Five testers were hired to test five different products for ease of use and effectiveness. If a tester was absent, there is no rating to report, and the value is recorded with an X for "absent." If the tester was unable to test the product adequately, there is no rating, and the value is recorded with an I for "incomplete test." The following program reads the data and displays the resulting SAS data set. Note the special missing values in the first and third data lines:

data period_a;
  missing X I;
  input Id $4. Foodpr1 Foodpr2 Foodpr3 Coffeem1 Coffeem2;
  datalines;
1001 115 45 65 I 78
1002 86 27 55 72 86
1004 93 52 X 76 88
1015 73 35 43 112 108
1027 101 127 39 76 79
  ;

proc print data=period_a;
  title 'Results of Test Period A';
  footnote1 'X indicates TESTER ABSENT';
  footnote2 'I indicates TEST WAS INCOMPLETE';
run;

The following output is produced:

Output with Multiple Missing Values

                   Results of Test Period A
 Obs   Id    Foodpr1    Foodpr2    Foodpr3   Coffeem1   Coffeem2

 1    1001     115         45         65          I         78
 2    1002      86         27         55         72         86
 3    1004      93         52          X         76         88
 4    1015      73         35         43        112        108
 5    1027     101        127         39         76         79

                   X indicates TESTER ABSENT
                I indicates TEST WAS INCOMPLETE

Previous Page | Next Page | Top of Page