Reading Missing Values at the End of a Record
When reading raw data that contains missing values at the end of the record, you can use the MISSOVER option in the INFILE statement to read the missing values. |
1---+----10---+----20 |
MALE 27 1 8 0 0 |
FEMALE 3 14 5 10 |
FEMALE 34 2 10 |
MALE 35 2 12 4 8 |
FEMALE 36 4 16 3 7 |
MALE 21 1 5 0 0 |
MALE 25 2 9 2 1 |
FEMALE 21 1 4 2 6 |
MALE 38 3 11 4 3 |
FEMALE 30 3 5 1 0 |
General form, INPUT statement using list input with
MISSOVER option:
INFILE file-specification MISSOVER; where MISSOVER prevents SAS from going to another record if, when using list input, it does not find values in the current line for all the INPUT statement variables. At the end of the current record, values that are expected but not found are set to missing. |
Simply specify the MISSOVER option in the INFILE statement.
In the example below, the MISSOVER option prevents the fields in the fourth
record from being read as values for Deptcard and
FreqDept in the third observation. Note that
Deptcard and FreqDept are set to missing. |
data perm.survey; infile credit missover; input Gender $ Age Bankcard FreqBank Deptcard FreqDept; proc print data=perm.survey; run; |
Obs | Gender | Age | Bankcard | FreqBank | Deptcard | FreqDept |
1 | MALE | 27 | 1 | 8 | 0 | 0 |
2 | FEMALE | 29 | 3 | 14 | 5 | 10 |
3 | FEMALE | 34 | 2 | 10 | . |
. |
4 | MALE | 35 | 2 | 12 | 4 | 8 |
5 | FEMALE | 36 | 4 | 16 | 3 | 7 |
6 | MALE | 21 | 1 | 5 | 0 | 0 |
![]() |
The MISSOVER option only works for missing values that occur at the end of the record. |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.