CACHE
CACHE.
This command does not read the active dataset. It is stored, pending execution with the next command that reads the dataset. See the topic Command Order for more information.
Although the virtual active file can vastly reduce the amount of temporary disk space required, the absence of a temporary copy of the “active” file means that the original data source has to be reread for each procedure. For data tables read from a database source, this means that the SQL query that reads the information from the database must be reexecuted for any command or procedure that needs to read the data. Since virtually all statistical analysis procedures and charting procedures need to read the data, the SQL query is reexecuted for each procedure that you run, which can result in a significant increase in processing time if you run a large number of procedures.
If you have sufficient disk space on the computer performing
the analysis (either your local computer or a remote server), you
can eliminate multiple SQL queries and improve processing time by
creating a data cache of the active file with the CACHE
command. The CACHE
command copies all of the data to
a temporary disk file the next time the data are passed to run a procedure.
If you want the cache written immediately, use the EXECUTE
command after the CACHE
command.
- The only specification is the command name
CACHE
. - A cache file will not be written during a procedure that uses temporary variables.
- A cache file will not be written if the data are already in a temporary disk file and that file has not been modified since it was written.
The CACHE
command can be executed from the Cache Data item on the File menu.
Example
CACHE.
TEMPORARY.
RECODE alcohol(0 thru .04 = ’sober’) (.04 thru .08 = ’tipsy’)
(else = ’drunk’) into state.
FREQUENCIES var=state.
GRAPH...
No cache file will be written during the FREQUENCIES
procedure. It will be written
during the GRAPH
procedure.