SAS/SHARE Macros for Server Access |
Overview of Macro Usage |
The information in this section is recommended primarily for server administrators and programmers who write applications that access shared data. For complete details about each macro that you can use to access a server and its libraries, see SAS/SHARE Macros.
Programs that use SAS/SHARE must include a LIBNAME statement that identifies the SAS/SHARE server through which a specified library will be accessed. Adding servers and changing server IDs can require users and server administrators to obtain current server ID information each time they want to access a server. That could make maintaining production or utility programs difficult.
Although there is no permanent connection between a SAS library and a specific server, there is frequently a logical connection. Programmers, server administrators, and users might always want to access a specific library through the same server because only one server at a time can provide access to a library. The same logical connection can also exist between a group of users and a server. This is an advantage if all the members of a department needed to use the same server, especially if they are sharing libraries.
To use SAS/SHARE most effectively without compromising performance, administrators often need a dynamic and flexible server environment. They need to be able to start and stop servers as the need arises, and to easily redistribute the load on the servers. They want to be able to switch libraries and users from one server to another quickly and easily. To balance the needs of both administrators and users, SAS/SHARE includes macros to be defined through the autocall function of the SAS macro facility.
These SAS/SHARE macros enable the administrator to define aliases for a server and to associate an alias with a specific library. Programs issue these macros to generate the requisite LIBNAME statements for accessing that library through the server that is associated with the alias. Then, the administrator can add servers, change server IDs, and switch libraries and users from one server to another with a process that is totally transparent to the program or the SAS user.
SAS/SHARE macros can be used to do the following:
generate and display the tables of macro variables that associate libraries with server aliases and server aliases with server IDs
The server ID that is associated with an alias can be changed during any appropriate server or application outage (for example, down time). You update only the file that contains the table of macro variables that maps aliases to server IDs. Additionally, a library can be logically associated with a different server by updating the table that associates libraries with server aliases.
For example, a site might have four logical servers (that is, four different server aliases) but only one physical server by having all the aliases map to the same server ID. Whenever the load on that one server gets too heavy, the site can start an additional server and shift specific libraries and users to it by simply pointing one of the aliases to that new server.
Utility Macros |
The following utility macros can be used by all SAS/SHARE programs and sessions:
compiles all the other macros and builds the server-alias and library-alias tables.
takes a server alias and looks up the server ID in the server-alias table and generates server-ID or SERVER=server-ID, as appropriate.
returns the index of the entry in the server information table for the specified server.
User Program Macro |
The following is a user program macro:
takes a libref and an optional physical library name and looks up the SAS library name in the library-alias table and generates a LIBNAME statement.
Server Administrator (Operator) Macros |
The following server administrator macros are used in server administrator programs.
starts a server with the appropriate server ID by using the SERVERID macro to convert the alias. The STRTSRV macro takes a server alias and PROC SERVER statement options.
generates the PROC OPERATE statement and STOP SERVER command for the appropriate server ID by using the SERVERID macro to convert the alias. The SHUTSRV macro takes a server alias and an optional password.
generates PROC OPERATE statements for the appropriate server ID by using the SERVERID macro to convert the alias. The OPERATE macro takes a server alias and an optional password.
generates a SET SERVER server ID statement by using the SERVERID macro to convert the alias. The SETSRV macro takes a server alias and an optional password.
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.