Understanding Pre-Assigned Libraries

Deciding whether to pre-assign a library or not has important consequences. One factor to keep in mind is that pre-assigning an excessive number of libraries can slow the execution of SAS jobs for all users. Other factors are described in Understanding Native Engines and the Metadata LIBNAME Engine. SAS clients and stored processes can access a library using one of two engines:
  • the native engine that is specified in the library's metadata or a file such as an autoexec file. In this case, the Base SAS engine is used for libraries of SAS data sets, the ORACLE engine is used for Oracle libraries, and so on.
  • the Metadata LIBNAME Engine.
Which engine you use affects security and determines what operations are possible.
Note: If you are defining a pre-assigned DBMS library, do not use the Pre-Assigned Library resource template. Register the library using the appropriate DBMS library template.
If you pre-assign libraries, then you control which engine is used to access the data.
If you choose to pre-assign libraries with LIBNAME statements in an autoexec file, then you should still register the library in metadata. Registering the library in metadata makes it available for use by SAS clients that read from metadata, such as SAS Data Integration Studio.
Having the server process assign libraries upon start-up results in library assignments that are identical and guaranteed across all SAS client applications and servers. Some environments where this approach to assigning libraries is desirable include the following:
  • environments where users are executing stored processes, and you do not want programmers having to manage library assignments in their code or in autoexec files.
  • environments where the DATA Step Batch Server is used to execute jobs created by SAS Data Integration Studio, and library assignments for these jobs should be identical to assignments used when the process was created.
  • environments where SAS Enterprise Guide or SAS Add-In for Microsoft Office users are running tasks that need to create tables in the library that is registered in metadata. When you register a client-assigned library (a library that is not pre-assigned), SAS Enterprise Guide and SAS Add-In for Microsoft Office assign the library to use the metadata engine by default. Metadata engine libraries do not update metadata after changes to the underlying data source. Metadata can be updated to reflect changes to the underlying data source with PROC METALIB or with the register tables function of SAS Management Console.
When libraries are assigned by the client application, each application can assign the library in a way that is most suitable for its intended user base, and library connections are established only if needed. When libraries are assigned by the server, each library is available to all server processes and each library is allocated the same way for all client applications. A mixture of some server-assigned and some client application-assigned libraries is typically required to meet the needs of all the users in your environment.