Overview of File Access

In this chapter you learn about external files and how to refer to an external file, whether it is a text file or a binary file. You learn how to read data from a file by using the INFILE and INPUT statements and how to write data to an external file by using the FILE and PUT statements.

With external files, you must know the format in which the data are stored or to be written. This is in contrast to SAS data sets, which are specialized files with a structure that is already known to the SAS System.

The SAS/IML statements used to access files are very similar to the corresponding statements in the SAS DATA step. The following table summarizes the IML statements and their functions.

Statement

 

Function

CLOSEFILE

 

closes an external file

FILE

 

opens an external file for output

INFILE

 

opens an external file for input

INPUT

 

reads from the current input file

PUT

 

writes to the current output file

SHOW: FILES

 

Shows all open files, their attributes, and their status

   

(current input and output files)