SAS Companion for the Microsoft Windows Environment |
The
following are some additional features of the SAS System
that you can control to improve system performance and make efficient use
of your computer's resources. For additional information about optimizing
SAS performance, see the chapter on optimizing system performance in SAS Language Reference: Concepts.
- Create SAS data sets instead of accessing
flat
ASCII files. The SAS System can access a SAS data set more efficiently than
it can read flat files.
Also, you should convert existing data sets that you
use frequently to Version 8 format.
- In your SAS code, use IF-THEN-ELSE conditional
structures instead of multiple IF-THEN structures. When one condition in the
IF-THEN-ELSE structure is met, control returns to the top of the structure
(skipping the ELSE clause, which might contain subsequent IF-THEN structures).
With multiple IF-THEN structures, each condition must be checked.
- When using arrays, make them _TEMPORARY_ if possible.
This speeds retrieval time.
- Use programming structures that reduce file I/O,
the most time-intensive aspect of SAS processing. Some ideas for reducing
file I/O are:
- Use the WHERE statement in a procedure to reduce
extra data processing.
- Use indexed data sets to speed access to the desired
observations.
- Use the SQL procedure to subset and group your
data.
-
Experiment with the value of the CATCACHE system
option,
which specifies the number of SAS catalogs to keep open at one time. By default,
no catalogs are cached in memory (and CATCACHE is set to 0). Caching catalogs
is an advantage if one SAS application uses catalogs that are subsequently
needed by another SAS application. The second SAS application can access
the cached catalog more efficiently.
Note: Storing catalogs in memory can consume considerable
resources. Use this technique only if memory issues are not a concern.
-
Store
your data sets in a compressed format (using the
COMPRESS data set option). This can improve the performance of your SAS application,
though it might require more CPU time to decompress observations as SAS needs
them. The COMPRESS data set option is described in the data set options section
of SAS Language Reference: Dictionary.
- You can use the resource file tracking facility
to create a scaled-down version of the SAS System that occupies the least
amount of hard disk space necessary. For more information, see Creating a Scaled-Down Version of the SAS System for Distribution.
- If you are using Windows NT and you specify the Scatter-read/Gather-write
system option, SGIO, the SAS System bypasses intermediate buffer transfers
when reading or writing data. The SAS System will read ahead the number of
pages specified by the BUFNO system option and place the data in memory before
it is needed. When the data is needed it is already in memory, and is in effect
a direct memory access. As the value of the BUFNO system option increases,
I/O performance improves. Scatter-read / gather-write is active
only for SAS I/O opened in INPUT or OUTPUT mode. If any SAS I/O files are
opened in UPDATE or RANDOM mode, SGIO is inactive for that process.Compressed
and encrypted files can also be read ahead using Scatter-read/Gather-write.
For more information on the SGIO system option, see SGIO.
Note: Windows
NT 4 Service Pack 4 is required to use the SGIO system option.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.