The OBSBUF= data
set option specifies the number of observations that can be read into
the view buffer at a time. The
view buffer is a segment of memory that is allocated to hold output observations
that are generated from a DATA step view. The size of the buffer determines
how much data can be held in memory at one time. OBSBUF= enables you
to tune the performance of reading data from a DATA step view.
The view buffer is shared
between the request that opens the DATA step view (for example, a
SAS procedure) and the DATA step view itself. Two computer tasks coordinate
between requesting data and generating and returning the data as follows:
-
When a request task
(such as a PRINT procedure) requests data, task switching occurs from
the request task to the view task in order to execute the DATA step
view and generate the observations. The DATA step view fills the view
buffer with as many observations as possible.
-
When the view buffer
is full, task switching occurs from the view task back to the request
task in order to return the requested data. The observations are cleared
from the view buffer.
The size of the view
buffer determines how many generated observations can be held. The
number of generated observations then determines how many times the
computer must switch between the request task and the view task. For
example, OBSBUF=1 results in task switching for each observation,
while OBSBUF=10 results in 10 observations being read into the view
buffer at a time. The larger the view buffer is, the less task switching
is needed to process a DATA step view, which can speed up execution
time.
To improve efficiency,
first determine how many observations fits into the default buffer
size, then set the view buffer so that it can hold more generated
observations.
Note: Using OBSBUF= can improve
processing efficiency by reducing task switching. However, the larger
the view buffer size, the more time it takes to fill. This delays
the task switching from the view task back to the request task in
order to return the requested data. The delay is more apparent in
interactive applications. For example, when you use the
Viewtable window, the larger the view buffer, the longer
it takes to display the requested observations. The view buffer must
be filled before even one observation is returned to the
Viewtable. Therefore, before you set a very large view
buffer size, consider the type of application that you are using to
process the DATA step view as well as the amount of memory that you
have available.