Use the TRUNCOVER option
when you are reading data using column or formatted input. If a variable’s
field extends past the end of the data line, then, by default, SAS
goes to the next line to start reading the variable’s value.
This option tells SAS to read data for the variable until it reaches
the end of the data line, or until it reaches the last column that
is specified in the format or column range, whichever comes first.
The next file contains addresses and must be read using column or
formatted input because the street names have embedded blanks. Note
that the data lines are all different lengths:
John Garcia 114 Maple Ave.
Sylvia Chung 1302 Washington Drive
Martha Newton 45 S.E. 14th St.
The program uses column
input to read the address file. Because some of the addresses stop
before the end of the variable Street’s field (columns 22 through
37), the TRUNCOVER option is necessary. Without the TRUNCOVER option,
SAS would try to go to the next line to read the data for Street on
the first and third records.
DATA homeaddress;
INFILE 'c:MyRawDataAddress.dat' TRUNCOVER;
INPUT Name $1-15 Number 16-19 Street $22-37;
run;
TRUNCOVER is similar
to MISSOVER. Both assign missing values to variables if the data
line ends before the variable’s field starts. But when the
data line ends in the middle of a variable field, TRUNCOVER covers
the first 80 characters of the line, whereas MISSOVER assigns the
variable a missing value.