Chapter Contents

Previous

Next
SAS Companion for the CMS Environment

WORK Library

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 space in the WORK library. If you run out of 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.TEMP.DATA.                           
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEMP may be incomplete.  When this step was
         stopped there were 117 observations and 3 variables.
WARNING: Data set WORK.TEMP was not replaced because this step was stopped. 

Here are several possible solutions to this problem:

  1. Perform file cleanup to free up space.

  2. Define a virtual disk or a temporary disk for your WORK library. Point WORK or USER to the virtual disk or the temporary disk. See Directing Temporary SAS Data Sets to the USER Library for more information.

  3. Ask your systems programmer to increase the allocation of the minidisk where the WORK library resides or to increase the limits for your userid in the SFS pool where your WORK library resides. See Increasing the Size of the WORK Library for more information.


Increasing the Size of the WORK Library

By default, SAS creates the WORK library on the CMS minidisk that has the largest amount of R/W space available.

You may also want to access a minidisk and reserve it exclusively for SAS WORK files. Use the SAS system option SIODISK= to tell SAS which filemode or SFS directory to use for the WORK library. (See SIODISK=.)


Deleting Temporary SAS Data Sets

Under CMS, temporary SAS data set means a data set that is stored in a temporary SAS data 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 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. You can make the USER library as large as you need it to be.

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.  [cautend]

You can use either a temporary data set or a permanent data set for the library, and you can put the library either on disk or on tape. The data set can be either a Version 6 or Version 7 SAS data library. The following table summarizes differences between the WORK and USER libraries.

Differences between the WORK and USER Libraries
Library Type of Data Set Storage Medium Format
WORK temporary disk V7
USER temporary or permanent disk or tape V7 or V6

The following example illustrates the use of the USER= system option. The numbered lines of code are explained below.


    filename giant 'survey tvdata a1';
    libname result 'my.tv.sasdata';
[1]   libname temp 'f';
[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;
  1. The LIBNAME statement associates the libref TEMP with the F minidisk.

  2. In the OPTIONS statement, the USER= system option designates the TEMP libref as the temporary SAS data library. Any data sets that have one-level names and that are created by your SAS program will be stored in this library.

  3. A one-level name is used in the DATA statement. When the DATA step is processed, the SAS data set TEMP.TOTALUSA is created.

  4. Because the large TOTALUSA data set was directed to the TEMP library, there is more space available in the WORK library for the utility files that the FREQ procedure requires.

  5. The SAS data set FREQDATA contains the results of the FREQ procedure. A two-level name is used to store FREQDATA in the permanent SAS data library MY.TV.SASDATA.


Chapter Contents

Previous

Next

Top of Page

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