Chapter Contents

Previous

Next
SAS Companion for the CMS Environment

Clearing Librefs and DDnames

To clear a libref that was assigned in a LIBNAME statement, issue a LIBNAME statement in the following form:

LIBNAME libref <CLEAR>;

Or issue a LIBNAME function:

LIBNAME (libref, CLEAR);

Alternatively, in the windowing environment, use the EXPLORER window to clear a libref. In the EXPLORER window (available as an option of the VIEW pmenu), select the libref, press the left mouse button (or the 3270 equivalent if you do not have a mouse), and select DELETE from the pull-down menu.

The LIBNAME statement, LIBNAME function, and the EXPLORER window deassign the libref and deallocate the library only if no other librefs are assigned to that library.

Note:   Librefs are cleared automatically at the end of your SAS session.  [cautionend]

To clear a DDname that you have used as a libref in a SAS program, first clear the libref as shown. This step is necessary because the first time you use a DDname in a SAS program, SAS assigns it as a libref for the SAS data library. Then issue the CMS FILEDEF command with the CLEAR option to clear the DDname.

For example, suppose that you had used the CMS FILEDEF command to assign the DDname MYLIB to a SAS data library and that you subsequently used the DDname as a libref in a SAS program. The following two statements would clear both the libref and the DDname:

libname mylib clear;
x filedef mylib clear;

If the data library is currently being used by a DATA step or PROC, the LIBNAME statement or function fails.


Chapter Contents

Previous

Next

Top of Page

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