The SASFILE statement
opens a SAS data set and allocates enough buffers to hold the entire
file in memory. Once it is read, data is held in memory, available
to subsequent DATA and PROC steps or applications, until either a
second SASFILE statement closes the file and frees the buffers or
the program ends, which automatically closes the file and frees the
buffers.
Using the SASFILE statement
can improve performance by
-
reducing multiple open or close
operations (including allocation and freeing of memory for buffers)
to process a SAS data set to one open or close operation
-
reducing I/O processing by holding
the data in memory.
If your SAS program
consists of steps that read a SAS data set multiple times and you
have an adequate amount of memory so that the entire file can be held
in real memory, the program should benefit from using the SASFILE
statement. Also, SASFILE is especially useful as part of a program
that starts a SAS server such as a
SAS/SHARE server. However, as with
most performance-improvement features, it is suggested that you set
up a test in your environment to measure performance with and without
the SASFILE statement.