WORK System Option: Windows

Specifies the location of the Work library.

Valid in: configuration file, SAS invocation, SASV9_OPTIONS environment variable
Category: Environment Control: Files
PROC OPTIONS GROUP= ENVFILES
Default: !TEMP\SAS Temporary Files
Windows specifics: all
See: WORK= System Option in SAS System Options: Reference

Syntax

-WORK filename | directory

Required Arguments

filename

specifies a file that contains a list of directories and optional keywords. SAS chooses a directory from the list in the file. That directory is the location for the Work library for the current SAS session.

directory

specifies a directory as the location for the Work library for the current SAS session.

Details

The Basics

When you use the filename option, SAS selects a directory to use as the location for the Work library. SAS randomly selects a directory or selects a directory based on available space. You use the METHOD keyword to make your selection.
When you use the directory option, SAS continues its initialization, using the specified directory as the location for the Work library.

Making the Allocation of Work Libraries Dynamic

The filename option contains a list of directories that are used for the Work library. Individual SAS Work libraries reside in a single directory. You use METHOD=RANDOM to specify that the directory for the Work library is randomly chosen from the list of directories. SAS selects one directory per session as the location for the Work library. This selection enables you to balance the I/O load across multiple hardware systems. You use METHOD=SPACE to specify the directory that has the most available space. When the METHOD keyword is not specified, SAS defaults to randomly selecting a directory.

Examples

Example 1: Spreading a Processing Load across Multiple Volumes of Different Disks

The configuration file (Default location: C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg) or command line includes the following:
-WORK “C:\SASWork\created file name.txt”
The following example shows how to spread an I/O processing load across multiple volumes of different disks. In this case, you use METHOD=RANDOM. A text file named C:\SASWork\created file name.txt contains the following information:
/disk1/sastempfiles
	/disk2/sastempfiles
	/disk3/sastempfiles
	Method=Random
Note: The Work library for a SAS session is placed on either disk1, disk2, or disk3 at random.

Example 2: Choosing the Directory That Has the Most Free Space

When you process your data, you can choose the directory that has the most free space. In this case, you use METHOD=SPACE. In this example, C:\SASWork\created file name.txt contains the following directories:
/disk1/sastempfiles
	/disk2/sastempfiles
	/disk3/sastempfiles
	Method=Space
Note: The Work library is placed on the disk with the most free space.