At times
during a SAS session, you might want to use external files, that is,
files that contain data or text, or files in which you want to store
data or text. These files are created and maintained by other applications
or by SAS. You can create, read, write, and delete external files
from within SAS.
You can use external
files in a SAS session to perform the following functions:
-
hold raw data to be read with the
INPUT statements
-
store printed reports created by
a SAS procedure
-
submit a file containing SAS statements
for processing
-
store data written with PUT statements
For SAS, external files
and devices can serve both as sources of input and as receivers of
output. The input can be either raw data to be read in a DATA step
or SAS statements to be processed by SAS. The output can be one of
the following:
-
the SAS log, which contains notes
and messages produced by the program
-
the formatted output of SAS procedures
-
data written with PUT statements
in a DATA step
You might
also want to use peripheral devices such as a printer, plotter, or
your own terminal. UNIX treats these I/O devices as if they were files.
Each device is associated with a file, called a special file, which
is treated as an ordinary disk file. When you write to a special file,
the associated device is automatically activated. All special files
reside in the
dev
directory or its subdirectories.
Although there are some differences in how you use the various devices,
the basic concept is the same for them all.
UNIX also enables you
to use pipes to send data to and from operating system commands as
if they were I/O devices.