INFILE statement notes
You have seen the INFILE statement before (in example 2). On the VAX and PC's almost all files are of variable length.
For example, assume you have the data from example 1 in a file.
File contents (4 lines):
1 68 144 M_ 2 78 202 M 34_ 3 62 99 F 37_ 4 61 101 F 45_
Note the _ to denote the end-of-line and that there are only 4 values in the first line.
The log indicates problems.
1 DATA LISTINP; 2 INFILE EXAMPLE1; 3 INPUT ID HEIGHT WEIGHT GENDER $ AGE; 4 NOTE: 4 records were read from the infile EXAMPLE1. The minimum record length was 10. The maximum record length was 13. NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.lstTINP has 3 observations and 5 variables.
The lis indicates problems.
OBS ID HEIGHT WEIGHT GENDER AGE 1 1 68 144 M 2 2 3 62 99 F 37 3 4 61 101 F 45
Recall that the INPUT statement is driven by the variables; The INPUT statement has 5 variables but the first data line has 4 values. Without the MISSOVER option, the INPUT statement simply "went to a new line" to get the data. The value of AGE is thus what should have been ID in the second record.
Note that this has the effect of "loosing" the second record; There is no ID=2.
Use the MISSOVER option in the INFILE statement.
MISSOVER specifies that: |