Setting VBUFSIZE= and OBSBUF= for SAS DATA Step Views
When working with SAS DATA step views, specifying either the OBSBUF= data set
option or the VBUSIZE= system option can improve processing efficiency by reducing
task switching. The VBUFSIZE= system option enables you to specify the size of the
view buffer based on number of bytes. The default buffer size is 65536. The OBSBUF=
data set option sets the view buffer size based on a specified number of observations. In
either case, setting the view buffer so that it can hold more generated observations
speeds up execution time by reducing task switching.
For more information about the VBUFSIZE= system option, see “VBUFSIZE= System
Option” in SAS System Options: Reference. For more information about the OBSBUF=
data set option, see “OBSBUF= Data Set Option” in SAS Data Set Options: Reference.
Using the SASFILE Statement
The SASFILE global statement opens a SAS data set and allocates enough buffers to
hold the entire data set in memory. Once it is read, data is held in memory, available to
subsequent DATA and PROC steps, 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 and close operations (including allocation and freeing of
memory for buffers) to process a SAS data set to one open and 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. For more information about the SASFILE global statement, see the SAS
Statements: Reference.
Using the DATASETS Procedure to Modify Attributes
Using the DATASETS procedure to modify variable attributes is more efficient than
using a DATA step, as long as this task is the only one PROC DATASETS has to
perform. The DATASETS procedure processes only the data descriptor information of a
data set. A DATA step processes an entire data set. For more information, see
“DATASETS” in Base SAS Procedures Guide.
Storing Variables as Characters
SAS uses eight bytes of storage for each numeric value processed in the DATA step and
one byte for each character. If you are not going to perform calculations on a variable
that contains numbers, you can save storage by defining the variable as a character
variable. When you reduce the amount of storage that is necessary for each variable, you
reduce the number of I/O operations.
Techniques for Optimizing I/O 203