LIBDEF Macro

Generates a LIBNAME statement.
Category: User

Syntax

%LIBDEF (libref,<SAS-library> ,<READONLY> ,<RETRY> ,<ENGINE=local-engine> ,<RENGINE=remote-engine> ,<RMTVIEW=remote-engine-RMTVIEW=-option>> ,<SLIBREF=server-library> , <uapw> , <APPLSYS=appl-sys-lib-table> );

Syntax Description

READONLY
specifies that the server library can be accessed in read-only mode.
RETRY
If a LIBNAME statement that specifies the SERVER= option fails, %LIBDEF generates a LIBNAME statement without the SERVER= option.
ENGINE=local-engine
specifies the local engine to be used in the user's session to access the server library. Omit this parameter unless you need to override the default engine.
Default:REMOTE
RENGINE=remote-engine
specifies the remote engine to be used in the server session to access the library. SAS chooses an appropriate engine. Omit this parameter unless you need to override the engine that is chosen by SAS.
Default:No default
RMTVIEW=remote-engine-RMTVIEW=-option
specifies the value of the REMOTE engine's RMTVIEW= option in the LIBNAME statement that is generated by the LIBDEF macro. You can use the RMTVIEW parameter to override the default value of the RMTVIEW option for a specific library. This parameter overrides the RMTVIEW= parameter in the SERVINFO and SERVLIB macros.
SLIBREF=server-library
specifies the libref that references the specified library in the server session. If this parameter is specified, the generated LIBNAME statement will include the SLIBREF= option. This parameter overrides any value that is specified for the SAS-data-library argument in the LIBDEF macro statement.
uapw
specifies that a user can access the server only by supplying a password.
APPLSYS=appl-sys-lib-table
specifies a new application system library table to be loaded. This argument is ignored if the table has already been specified in the SHRMACS call or in a previous LIBDEF call.

Details

The LIBDEF macro generates a LIBNAME statement to define a SAS library that will be accessed locally or through a server. The server administrator can specify a physical name or a reserved libref in the APPLSYS macro library. If a physical name is specified, the server administrator must specify that name as the second argument in this macro; the physical name should not be enclosed in quotation marks. If a libref is specified, the second argument (the physical name) is omitted.
If you specify a physical name that is not specified in the APPLSYS macro library, a LIBNAME statement is generated without the SERVER= option.
After executing the LIBDEF macro, the automatic macro variable SYSLIBRC contains the return code from the LIBNAME statement. For more information, see the section about Automatic Macro Variables in SAS Macro Language: Reference in SAS Macro Language: Reference.

Example

Here are three examples using the LIBDEF macro:
%libdef(mylib,SAS-data-library,applsys=qa);
%libdef(perm,SAS-data-library,readonly,retry,myuserpw);
%libdef(datalib);