Using the RECFM= option in
the FILENAME, FILE, %INCLUDE, and INFILE statements enables you to
specify the record format of your external files. The following example
shows you how to use this option.
Usually, SAS reads a
line of data until a carriage return and line feed combination ('0D0A'x)
are encountered or until just a line feed ('0A'x) is encountered.
However, sometimes data do not contain these carriage–control
characters but do have fixed-length records. In this case, you can
specify RECFM=F to read your data.
To read such a file,
you need to use the LRECL= option to specify the record length and
the RECFM= option to tell SAS that the records have fixed-length record format.
Here are the required statements:
data test;
infile "test.dat" lrecl=60 recfm=f;
input x y z;
run;
In this example, SAS
expects fixed-length records that are 60 bytes long, and it reads
in the three numeric variables X, Y, and Z.
You can also specify
RECFM=F when your data contains carriage returns and line feeds, but
you want to read these values as part of your data instead of treating
them as carriage-control characters. When you specify RECFM=F, SAS
ignores any carriage controls and line feeds and simply reads the
record length that you specify.