|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|
By default, a subdirectory of the current directory contains the WORK data library. The name of the subdirectory that SAS creates for your WORK data library is SAS$WORKcurrent-pid, where current-pid is the unique 8-byte process-identification value that is assigned by OpenVMS. By default, this directory is created as a subdirectory of the directory that is referenced by the OpenVMS logical name SAS$WORKROOT. SAS$WORKROOT refers to SYS$DISK:[ ] by default, but your system manager may have redefined it. The default may be changed when the SAS System is installed by your system manager.
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]:
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|
Under OpenVMS, temporary SAS data set means a data set that is stored in a temporary SAS work library. That is, you cannot designate the data set itself as temporary, but the data set takes on the attribute of the library in which it is stored.
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|
An alternative to deleting the temporary SAS data sets is to direct them to a different SAS data library. You can use the USER= system option to store temporary data sets in the USER library rather than in the WORK 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
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]';  libname temp 'disk2:[temp]';  options user=temp;  data totalusa; infile giant; input home_id region income viewers cable; if home_id=. then delete; run;  proc freq; tables region*income*viewers*cable  / 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:
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|
Two system options control the creation and deletion of the WORK subdirectory. By default, the WORK subdirectory is deleted at the end of each SAS session, and a new one is created at the beginning of the next session. The WORKTERM system option controls the deletion of the WORK subdirectory, and the WORKINIT system option controls the creation of the new subdirectory.
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|
Under OpenVMS, the CLEANUP tool is available to conveniently delete the WORK data library. When a SAS session terminates normally, the WORK library is deleted automatically (this is the default action). However, if your SAS session terminates abnormally, the WORK library and the files in it may not be deleted properly. To delete this WORK data library, use 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 [.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;1is 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.
Top of Page
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.