Chapter Contents

Previous

Next
CACHESIZ=

CACHESIZ=



Controls the size of the I/O data cache that is allocated for a SAS file

Language element: data set option
Default: 65024
Engines: V6, V7, V8
Valid as: data set option, engine or host option
OpenVMS specifics: All aspects are host-specific


Syntax
Details
Comparisons
See Also

Syntax

CACHESIZ=integer

integer
can range from 0 to 65,024. By default, SAS uses a value that is an even multiple of the file's page size. If you specify a value of 0, SAS does not use a data cache. The default value is 65024.


Details

Pages of SAS files are cached in memory with each cache containing multiple pages. The CACHESIZ= data set option controls the size (in bytes) of the data cache used to buffer the I/O pages. Note that memory is consumed for each data cache, and multiple caches are used for each data set opened. Thus, the disadvantage of specifying extremely large CACHESIZ= values is large consumption of memory. The advantage of a larger CACHESIZ= value is that it reduces the actual number of disk I/Os required to read from or write to a file. For example, if you are reading a large data set, you can use the following statements:

libname test v8 '[mydir]';
data new;
   set test.big(cachesiz=65024);
   . . . more data lines . . .
run;

This DATA step reads the TEST.BIG data set in the most efficient manner.

If a data cache is used, then one disk I/O is the size of the CACHESIZ= value. If no data cache is allocated, then one disk I/O is the size of the BUFSIZE= value. The size of the page is controlled with the BUFSIZE= data set option.


Comparisons

The CACHESIZ= and BUFSIZE= data set options are similar, but they have important differences. BUFSIZE= specifies the file's page size, which is a permanent attribute of the file. It can be set only when the file is created. CACHESIZ= is the size of the internal memory cache that is used for the life of the current file open. It can change any time the file is opened. Specifying a large BUFSIZE= value and CACHESIZ=0 improves I/O the same way that specifying a large CACHESIZ= value does. However, because only complete pages can be written to the file, if the actual data require less space than the specified BUFSIZE= value, the file uses more disk space than necessary.

For example, if you specify BUFSIZE=65024 and CACHESIZ=0, I/O is performed in increments of the page size. If the data actually require only 32,000 bytes of storage, then more than half the space allocated for the file is unused. If you specify BUFSIZE=32768 and CACHESIZ=65024, I/O is still performed in increments of 65,024 bytes; however, if the data require only 32,000 bytes, little space is wasted.

See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.