Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Language Reference

INFILE Statement

opens a file for input

INFILE operand <options>;

The inputs to the INFILE statement are as follows:
operand
is either a predefined filename or a quoted string containing the filename or character expression in parentheses referring to the filepath.

options
are explained below.
You can use the INFILE statement to open an external file for input or, if the file is already open, to make it the current input file so that subsequent INPUT statements read from it.

The options available for the INFILE statement are described below.

LENGTH=variable
specifies a variable in which the length of a record will be stored as IML reads it in.

RECFM=N
specifies that the file is to be read in as a pure binary file rather than as a file with record separator characters. To do this, you must use the byte operand (<) on the INPUT statement to get new records rather than using separate input statements or the new line (/) operator.

The following options control how IML behaves when an INPUT statement tries to read past the end of a record. The default is STOPOVER.

FLOWOVER
allows the INPUT statement to go to the next record to obtain values for the variables.

MISSOVER
tolerates attempted reading past the end of the record by assigning missing values to variables read past the end of the record.

STOPOVER
treats going past the end of a record as an error condition, which triggers an end-of-file condition.

Several examples of INFILE statements are given below:
   filename in1 'student.dat';  /* specify filename IN1   */
   infile in1;                  /* infile filepath        */

   infile 'student.dat';        /* path by quoted literal */

   infile 'student.dat' missover;       /* using options  */
See Chapter 7, "File Access," for further information.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.