Chapter Contents |
Previous |
Next |
INFILE |
Language element: | statement |
Valid: | in a DATA step |
OpenVMS specifics: | valid values for file-specification; valid values for host-option-list |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
INFILE file-specification
<option-list>
|
FAC= | MBC= |
KEY= | MBF= |
KEYVALUE= | RECFM= |
LINESIZE= | SHR= |
LRECL= |
For an explanation of these options, see Host-Specific External I/O Statement Options in the FILENAME statement.
Note: When using the PIPE device with the INFILE statement, only LRECL
is supported.
Details |
Because the INFILE statement identifies the file to read, it must execute before the INPUT statement that reads the input data records. You can use the INFILE statement in conditional processing, such as an IF-THEN statement, because it is executable. This allows you to control the source of the input data records.
When you use more than one INFILE statement for the same file specification and you use options in each INFILE statement, the effect is additive. To avoid confusion, use all the options in the first INFILE statement for a given external file.
Example |
The following is an example of an INFILE statement:
infile food;
This INFILE statement uses the default filename form of the file specification (FOOD has not been assigned as a SAS fileref or as an OpenVMS logical name). Therefore, the SAS System looks for the file FOOD.DAT in the current directory.
When the SAS System reads a file, it uses the most recent version by default. For example, if your default directory contains the files FOOD.DAT;1, FOOD.DAT;2, and FOOD.DAT;3, this INFILE statement reads FOOD.DAT;3.
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.