Chapter Contents |
Previous |
Next |
SAS Companion for the OpenVMS Operating Environment |
Disk space is the aspect of the WORK library that is most likely to require your consideration. If you have many large temporary SAS data sets, or if you use a procedure that has many large utility files (for example, a PROC FREQ step with a complex TABLES statement that you run against a large SAS data set), you may run out of disk space in the WORK library. If you run out of disk space in batch mode, your PROC or DATA step terminates prematurely and issues a message similar to the one shown in Insufficient WORK Space Message. In an interactive session, a dialog window asks you to specify what action to take.
Insufficient WORK Space Message
ERROR: Insufficient space in file WORK.DATASET.DATA. NOTE: The SAS System stopped processing this step because of errors. NOTE: SAS set option OBS=0 and will continue to check statements. This may cause NOTE: No observations in data set. WARNING: The data set WORK.DATASET may be incomplete. When this step was stopped there were 22360 observations and 4 variables. ERROR: Errors printed on page 1. NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC 27513 |
Ask your system administrator to increase the disk quota that has been assigned to you, or ask for the disk to be cleaned up. Following are several methods of increasing your WORK space:
Changing the Location of the WORK Library |
You can change the location of the WORK data library either by redefining the OpenVMS logical name SAS$WORKROOT or by specifying the WORK= system option. For example, the following SAS command tells SAS to create the WORK subdirectory in the directory DISK:[XDIR]:
$ SAS8/WORK=DISK:[XDIR]
When SAS creates the WORK subdirectory, it also creates an OpenVMS process-level logical name, SAS$WORKLIB, that references the WORK data library. You can use this logical name within the SAS session to reference files in the WORK subdirectory. It remains defined after the SAS session terminates.
Deleting Temporary SAS Data Sets |
One simple way to conserve space in the WORK library is to delete each temporary SAS data set with a PROC DATASETS step after you no longer need it. However, there are two problems with this method.
Directing Temporary SAS Data Sets to the USER Library |
Note: Utility data sets that are created by SAS procedures continue
to be stored in the WORK library. However, any data sets that have one-level
names and that are created by your SAS programs will be stored in the USER
library.
The following example illustrates the use of the USER= system option. The numbered lines are explained following the code.
filename giant 'mydisk:[survey]tvdata.dat'; libname result 'mydisk:[sasdata]'; [1] libname temp 'disk2:[temp]'; [2] options user=temp; [3] data totalusa; infile giant; input home_id region income viewers cable; if home_id=. then delete; run; [4] proc freq; tables region*income*viewers*cable [5] / noprint out=result.freqdata; run;
Note: You can also assign the USER libref directly by using the LIBNAME statement as follows:
libname user '[mydir]';
You can specify the USER= system option in the SAS command, as in the following example:
$ SAS8/USER=[MYDIR]
Note: Unlike the WORK library, when you use the user
library to store temporary files, these files are not automatically deleted
when the SAS System terminates.
System Options That Control the WORK Data Library |
The default value of the WORKINIT system option is WORKINIT, and the SAS System automatically creates a WORK subdirectory as it initializes. If you specify NOWORKINIT, the SAS System looks for an existing WORK subdirectory in the current directory and uses it, as is, if it exists. If it does not exist, one is created. You can specify the WORKINIT system option in the SAS command or in a configuration file.
If you have logged out of your OpenVMS process since the previous WORK subdirectory was saved, the SAS System cannot find the WORK data library even if you specify NOWORKINIT, so it creates a new WORK data library. This is because your OpenVMS process ID has changed and the subdirectory name includes the OpenVMS process ID. In this case, the old WORK data library still exists (it was not written over), and you can assign a new libref to the old WORK subdirectory (SAS$WORKold-pid) after you get into your SAS session and use the files through the new libref. Search the default directory for the old SAS session to find the old WORK subdirectory name. You can use the X statement within your current SAS session to perform this directory search.
The WORKTERM option controls whether the WORK subdirectory is deleted at the end of your SAS session. The default value is WORKTERM. If you specify NOWORKTERM, the WORK subdirectory is not deleted at the end of the session and remains available for use with the next SAS session. Remember, however, that you must specify NOWORKINIT in the next invocation of the SAS System in order to reuse the WORK subdirectory that you saved.
The WORKTERM and WORKINIT system options are portable and are documented in SAS Language Reference: Dictionary.
The CLEANUP Tool |
$ CLEANUP == "$SAS$ROOT:[PROCS]CLEANUP.EXE"
Then, issue the CLEANUP command from your DCL prompt to delete WORK data libraries from one or more directories.
The following are some syntax variations to keep in mind:
$ CLEANUP
$ CLEANUP [.TEMP]
$ CLEANUP [...]
The CLEANUP command accepts the following qualifiers:
Note: The /V5 | /NOV5
and /V6 | /NOV6 options for the CLEANUP command are not supported in Version
8 of the SAS System.
For each WORK data library that exists in the specified directory, the CLEANUP tool issues the question
OK to delete device:[dir]SAS$WORKnnnnnnnn.DIR;1 [YES]?where
device:[dir]
is the name of the disk and directory to which you were attached when you
invoked the SAS System, and
SAS$WORKnnnnnnnn.DIR;1
is the subdirectory
that contains the WORK library. YES is the default response, so to execute
the CLEANUP command, press the RETURN key. When the CLEANUP tool executes,
it lists the names of the files being deleted. If the specified directory
contains more than one WORK subdirectory, the CLEANUP tool then issues the
previous question for the next WORK data library.
If the CLEANUP tool is not available at your site, contact your SAS Support Consultant.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.