space
Previous Page | Next Page

SAS/IntrNet 9.2: Application Dispatcher

ALLOCATE LIBRARY Statement


Defines a library that the Application Server assigns


Syntax

ALLOCATE LIBRARY libref <engine> 'SAS-data-library' <options>;

Note: The syntax of the ALLOCATE LIBRARY statement is identical to that of the global LIBNAME statement. The above syntax is simplified. For a complete listing of arguments and explanations, see the LIBNAME statement in SAS Language Reference: Dictionary.


Arguments

libref
associates a SAS libref (shortcut name) with a SAS data library. The libref specifies either the name of an existing server library or the name of a new library reference that is defined when you enter this statement. You can list SAS librefs that are defined in the ALLOCATE LIBRARY statement in a DATALIBS, PROGLIBS, or ADMINLIBS statement.

SAS librefs that are listed in PROGLIBS or ADMINLIBS statements are assumed to contain catalogs that contain SAS programs that can be executed by the Application Server. The SAS programs can be SOURCE, MACRO, or SCL catalog entries.

SAS librefs that are listed in a DATALIBS statement are available to all programs that are run by the Application Server.

Note: SAS librefs that are defined outside PROC APPSRV by using LIBNAME statements are not accessible by Application Server programs and cannot be listed in a DATALIBS, PROGLIBS, or ADMINLIBS statement.

engine
specifies the name of a valid SAS engine that you want to use to access the server library. Specify this option only if you want to override the SAS default for a specific server, or if you want to reduce the time that is needed for the client to determine which engine to use to access a specific server.

SAS-data-library
must be a valid physical name for the SAS data library on your host system. You must enclose the physical name in single or double quotation marks.

The physical name of the SAS data library is the name that is recognized by the operating environment.

options
See the LIBNAME statement in the SAS Language Reference: Dictionary for a complete list of options.

Nesting Library Names in Concatenated Libraries

Concatenated Data Libraries

You must list all data libraries that are nested in a concatenated library in DATALIBS.

Single-level nested data libraries work properly regardless of the order of the libraries in the DATALIBS statement. For example,

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      DATALIBS ONE TWO;

works whether the order of the libraries is coded as DATALIBS ONE TWO or DATALIBS TWO ONE.

Multilevel nested libraries work only if the order in the DATALIBS statement is correct. The following code does not work because library THREE is assigned before library TWO:

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      ALLOC LIBRARY THREE ('/path/three' TWO);
      DATALIBS THREE TWO ONE;

Instead, use the following code:

   DATALIBS ONE TWO THREE;  /* or DATALIBS TWO ONE THREE; */

ALLOC statements are order dependent. PROC APPSRV performs an automatic check on library and file assignments during its startup phase. The code

   PROC APPSRV;
      ALLOC LIBRARY TWO ('/path/two' ONE);
      ALLOC LIBRARY ONE '/path/one';

fails because library ONE is not defined when the library TWO assignment is tested. This happens regardless of how the libraries are listed in the DATALIBS, PROGLIBS, or ADMINLIBS statements. Remember that the syntax is identical to that of a LIBNAME statement in SAS open code.

Every library that is used must be defined as a data library. The following code does not work because library ONE is not defined as a data library:

   PROC APPSRV;  
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      DATALIBS TWO;

Concatenated Program Libraries

Nested program libraries generally do not work as expected. For example, the following code does not work when you attempt to run a program in library TWO. This is because library ONE is not assigned in the request executive when you attempt to assign library TWO.

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      PROGLIBS TWO ONE;

You must change library ONE to a DATALIB by using the following code:

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      DATALIBS ONE;
      PROGLIBS TWO;

The same problem can occur when you use ADMINLIBS. This can cause the most confusion because it is not always obvious what can be causing the problem.

Previous Page | Next Page | Top of Page