Chapter Contents

Previous

Next
SAS Companion for UNIX Environments

Using Environment Variables as Librefs

An environment variable can also be used as a libref. The variable name must be in all upper case characters, and the variable value must be the full pathname of the directory, that is, the name of the directory must begin with a slash.

Suppose you want to use the data library in /users/mydir/educ, and you want to refer to it with the EDUC environment variable. You can define the variable at two times:

You cannot specify an engine when you define a libref as an environment variable, so the SAS System determines which engine to use as described in Omitting Engine Names From the LIBNAME Statement.

After the libref is defined, you can use it to access data sets stored in the library:

proc print data=educ.class; 
run;

Note:   If a variable and a libref have the same name but refer to different files, the SAS System uses the libref.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

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