Chapter Contents

Previous

Next
INFILE

INFILE



Specifies an external file to read with an INPUT statement

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>
<host-option-list>;

file-specification
identifies the source of input data records (usually an external file). It can be any of the file specification forms discussed in Identifying External Files to the SAS System. The reserved fileref DATALINES allows the INFILE statement to read instream data.

option-list
names portable options for the INFILE statement. For information about these options, see the INFILE statement in SAS Language Reference: Dictionary.

host-option-list
names external I/O statement options for the INFILE statement that are specific to the OpenVMS environment. These options can be any of the following:
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.

You can intersperse options from option-list and host-option-list in any order.

Note:   When using the PIPE device with the INFILE statement, only LRECL is supported.  [cautionend]


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.