Previous Page | Next Page

Using SAS Files

Using Environment Variables as Librefs in UNIX Environments

An environment variable can be used as a libref. The variable name must be in all uppercase 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.

Note:   SAS on UNIX does not support the assignment of the User libref using the USER environment variable.  [cautionend]

Suppose you want to use the 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 SAS 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; 

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

Previous Page | Next Page | Top of Page