|Statements under OpenVMS|
|Valid:||in a DATA step|
|OpenVMS specifics:||valid values for file-specification, host-options, and encoding-value|
|See:||INFILE Statement in SAS Language Reference: Dictionary|
identifies the source of the input data records (usually an external file). It can be any of the file specification forms discussed in Identifying External Files to SAS. The reserved fileref DATALINES allows the INFILE statement to read instream data.
For valid encoding values, see Encoding Values in SAS Language Elements in SAS National Language Support (NLS): Reference Guide.
For an explanation of these options, see Host-Specific External I/O Statement Options in the FILENAME statement.
Note: When you are using the PIPE device with the INFILE statement, only the LRECL= host option is supported.
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 enables 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.
The ENCODING= option is valid only when the INFILE statement includes a file specification that is not a reserved fileref. If the INFILE statement includes the ENCODING= argument and the reserved filerefs DATALINES or DATALINES4 as a file-specification, then SAS issues an error message. The ENCODING= value in the INFILE statement overrides the value of the ENCODING= system option.
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, SAS looks for the file FOOD.DAT in the current directory.
When SAS 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.