Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

New Uses for WORK Space

You can use the WORK library to contain more than just your temporary SAS data sets. Temporary external files can also be saved there, and it is also possible to create subdirectories within WORK and treat them as separate libraries.

New uses for WORK Space

The first step is to use the PATHNAME function to get the physical location of the WORK library. In the example, this is stored in macro variable &WORKPATH.

The two LIBNAME statements each use the DCREATE function to create a subdirectory within the WORK location. The value returned by the function is the physical location of the subdirectory. This enables a single SAS statement to both create the subdirectory and point a LIBNAME at it.

The data step then creates SAS data sets in both of the new libraries REST and PLAY. The FILE statement defines an external file, also within the WORK area, and the PUT statement writes records to this.

The WORK area is usually the best place for a temporary external file. It will not need to be explicitly deleted, because it will disappear automatically, along with everything else in WORK, at the end of the SAS session.

The ability to have multiple libraries within WORK can sometimes be quite useful, for example when there is a need to compare the temporary data sets created by two different versions of the same program. At the end of the SAS session, all of the subdirectories and their contents will disappear automatically, along with everything else in WORK.

Notice that libraries like REST and PLAY here are considered, from the point of view of the SAS language, to be "permanent" libraries, so they are not subject to certain restrictions that apply to the WORK library. For example (and for what it is worth), the REPLACE data set option will be available, whereas it cannot be used in WORK.