LIBNAME Function


Assigns or deassigns a libref for a SAS data library

Category: SAS File I/O

See: LIBNAME Function in the documentation for your operating environment.

Syntax

LIBNAME ( libref <, SAS-data-library <, engine <, options >>>)

Arguments

libref

  • specifies the libref that is assigned to a SAS data library.

SAS-data-library

  • specifies the physical name of the SAS data library that is associated with the libref. Specify this name as required by the host operating environment.

engine

  • specifies the engine that is used to access SAS files opened in the data library. If you are specifying a SAS/SHARE server, then the engine should be REMOTE.

options

  • names one or more options honored by the specified engine, delimited with blanks.

Details

If the LIBNAME function returns 0, then the function was successful. However, you could receive a non-zero value, even if the function was successful. A non-zero value is returned if an error, warning, or note is produced. To determine if the function was successful, look through the SAS log and use the following guidelines:

  • If a warning or note was generated, then the function was successful.

  • If an error was generated, then the function was not successful.

Operating Environment Information: Some systems allow a SAS-data-library value of ' ' (with a space) to assign a libref to the current directory. The behavior of LIBNAME when a single space is specified for SAS-data-library is host dependent.

If no value is provided for SAS-data-library or if SAS-data-library has a value of " (with no space), LIBNAME disassociates the libref from the data library.

Under some operating environments, the user can assign librefs using system commands outside the SAS session.

Examples

Example 1: Assigning a Libref

This example attempts to assign the libref NEW to the SAS data library MYLIB. If an error or warning occurs, the message is written to the SAS log. Note that in a macro statement you do not enclose character strings in quotation marks.

 %if (%sysfunc(libname(new,MYLIB))) %then    %put %sysfunc(sysmsg()); 

Example 2: Deassigning a Libref

This example deassigns the libref NEW that has been previously associated with the data library MYLIB in the preceding example. If an error or warning occurs, the message is written to the SAS log. Note that in a macro statement you do not enclose character strings in quotation marks.

 %if (libname(new)) %then    %put %sysfunc(sysmsg()); 

See Also

Function:

  • 'LIBREF Function' on page 634




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net