patterns of instruction and replaces them with more efficient sequences, and also
performs optimizations that pertain to the SAS register. In most cases, performing the
code-generation optimization is preferable. If you have a large DATA step program,
performing code generation optimization can result in a significant increase in
compilation time and overall execution time.
You can reduce or turn off the code generation optimization by using the
CGOPTIMIZE= system option. Set the code generation optimization that you want SAS
to perform using these CGOPTIMIZE= system option values:
0 performs no optimization during code compilation.
1 specifies to perform stage 1 optimization. Stage 1 optimization removes
redundant instructions, missing value checks, and repetitive computations for
array subscripts; detects patterns of instructions and replaces them with more
2 specifies to perform stage 2 optimization. Stage 2 performs optimizations that
pertain to the SAS register. Performing stage 2 optimization on large DATA step
programs can result in a significant increase in compilation time.
3 specifies to perform full optimization, which is a combination of stages 1 and 2.
This is the default value.
For more information, see “CGOPTIMIZE= System Option” in SAS System Options:
Calculating Data Set Size
If you have already applied optimization techniques but still experience lengthy
processing times or excessive memory usage, the size of your data sets might be very
large. In that case, further improvement might not be possible.
You can estimate the size of a data set by creating a dummy data set that contains the
same variables as your data set. Run the CONTENTS procedure, which shows the size
of each observation. Multiply the size by the number of observations in your data set to
obtain the total number of bytes that must be processed. You can compare processing
statistics with smaller data sets to determine whether the performance of the large data
sets is in proportion to their size. If not, further optimization might still be possible.
Note: When you use this technique to calculate the size of a data set, you obtain only an
estimate. Internal requirements, such as the storage of variable names, might cause
the actual data set size to be slightly different.
206 Chapter 12 • Optimizing System Performance