The infile statement replaces the cards statement when data is to be read from a file already on disk.
The infile statement MUST appear BEFORE the input statement that reads data from the file. The simple form of the statement is
infile 'c:\datafile\mydata.dat';
The filename is the full name of a file on the computer system
including the path and extension. In a DOS or Windows session, this
would be of the form given above while on a UNIX platform the
form would be '/datafiles/mydata.dat'.
The associated input statement should process the data in the file as usual.
Instead of specifying the filename directly, a SAS fileref can be used.
Two options are available with the infile statement. Example:
infile 'c:\datafile\mydata.dat' missover linesize=100;
The missover option is used to assign the missing value symbol to variables not given a value in a data line, and the linesize option changes the length of each line read from the data file from the default value of 80.
The infile statement can be used in place of the
cards statement by using the special filename cards.
The syntax is:
infile cards missover linesize=100;
This allows the missover and linesize options to be used when the raw data is given in the program editor window.
Copyright © 1997 by Jerry Alan Veeh. All rights reserved.