Previous Page | Next Page

Reading Raw Data

Reading Missing Values in Raw Data


Representing Missing Values in Input Data

Many collections of data contain some missing values. SAS can recognize these values as missing when it reads them. You use the following characters to represent missing values when reading raw data:

numeric missing values

are represented by a single decimal point (.). All input styles except list input also allow a blank to represent a missing numeric value.

character missing values

are represented by a blank, with one exception: list input requires that you use a period (.) to represent a missing value.

special numeric missing values

are represented by two characters: a decimal point (.) followed by either a letter or an underscore (_).

For more information about missing values, see Missing Values.

Special Missing Values in Numeric Input Data

SAS enables you to differentiate among classes of missing values in numeric data. For numeric variables, you can designate up to 27 special missing values by using the letters A through Z, in either upper- or lowercase, and the underscore character (_).

The following example shows how to code missing values by using a MISSING statement in a DATA step:

data test_results;
   missing a b c;
   input name $8. Answer1 Answer2 Answer3;
   datalines;
Smith    2 5 9
Jones    4 b 8
Carter   a 4 7
Reed     3 5 c
;

proc print;
run;

Note that you must use a period when you specify a special missing numeric value in an expression or assignment statement, as in the following:

x=.d;

However, you do not need to specify each special missing numeric data value with a period in your input data. For example, the following DATA step, which uses periods in the input data for special missing values, produces the same result as the input data without periods:

data test_results;
   missing a b c;
   input name $8. Answer1 Answer2 Answer3;
   datalines;
Smith    2 5 9
Jones    4 .b 8
Carter   .a 4 7
Reed     3 5 .c
;

proc print;
run;

Output for both examples is shown here:

Output of Data with Special Missing Numeric Values

                          The SAS System                         

          Obs     name     Answer1    Answer2    Answer3

         1     Smith        2          5          9   
         2     Jones        4          B          8   
         3     Carter       A          4          7   
         4     Reed         3          5          C   

Note:   SAS displays and prints special missing values that use letters in uppercase.  [cautionend]

Previous Page | Next Page | Top of Page