Starting a Server

PROC SERVER Statement

To start a server, execute the PROC SERVER statement, which enables multiple clients to simultaneously access and use SAS libraries and members in those libraries. As part of server start-up, you must assign a server name, but specifying operational attributes is optional.
To start a server with selected options, use the following syntax:
PROC SERVER <ID=server-ID> <ALLOC|NOALLOC> <AUTHENTICATE=OPT|REQ> <CLIENTID=SECURITY|SESSION> <LOG=value> <DTF=SAS-datetime-format> ;
The following sections explain the preceding options. For complete information about server options, see The SERVER Procedure . For an example of a typical log, see Sample Log for SAS/SHARE Server SHARE2.

Identifying the Server

ID=server-ID assigns a valid SAS name to the server. In SAS, valid names can contain a maximum of eight alphanumeric characters and can include the following special characters: dollar sign ($), at sign (@), and pound sign (#). For more information about the rules for naming SAS variables, see SAS Language Reference: Concepts.
Server names are also constrained by the operating environment under which that server runs and the access method that is used. For complete information about server IDs by operating environment, see Communications Access Methods for SAS/CONNECT and SAS/SHARE.
Here is an example of specifying a server ID:
proc server id=share1;

Limiting Users to Predefined Libraries

Use the NOALLOC option to limit users to accessing only libraries that you predefine to the server and to control which data users can access through the server.

Validating Server Users

Use the AUTHENTICATE= option to control whether the server will require clients to provide valid user IDs and passwords before they are connected to the server. See Ensuring That User IDs Are Valid.

Selecting How Clients Are Identified in the Log

Use the CLIENTID= option to specify whether clients are identified in the server log by their session names or their secured names. For more information, see PROC SERVER Statement.

Logging Server Usage Statistics

Usage statistics can be requested for each client that accesses a server. These statistics are useful for debugging and tuning server applications. Usage statistics also enable you to charge users for the amount of server resources that they consume. By default, the server writes a client's usage statistics to the server log when the client disconnects from the server. Here are some of the statistics that you can request:
Number of messages processed
shows the number of messages (requests and replies) that a client exchanges with a server in a single session.
Bytes transferred
shows the cumulative number of bytes that are received from a client and that are sent to a client in a single session.
Active and elapsed time
shows the cumulative elapsed time during which the server processed requests on behalf of a client in a single session. Although this figure is not CPU time, it is related to CPU time. Whereas CPU time for a specific operation usually is relatively independent of other server usage, this figure increases with an increased level of server activity. However, active time should give a good indication of the CPU usage by the client compared with other clients' values that are tracked during similar levels of server activity. The active time value can exceed the elapsed time value, especially in the server totals, because many server requests can be active (therefore, they are being timed) concurrently.
Here are examples of setting log usage:
proc server id=share1 log=message;
proc server id=share1 log=bytecount;
proc server id=share1 log=(message bytecount activetime elapsedtime);
proc server id=share1 log=all;
Here is an example of a client log for all statistics:
Usage statistics for user mike(1):
   Messages processed:       5,143
   Bytes transferred:       10,578K
   Active time:       1:47:23.6148
   Elapsed time:      3:28:64.7386
For complete information about the LOG option, see The SERVER Procedure. For a more complete example of a SAS log, see Usage Statistics in the Server Log.
To charge users for the amount of server resources that they consume, allocate consumption proportionately according to the usage statistics. You can allocate consumption based on a single statistic or on a combination of statistics. The most useful statistics for this purpose are the number of messages that are processed, the number of bytes that are transferred, and the amount of active time used.
You might need to experiment with the relative weights of these statistics in your charge-back formula. These statistics are sensitive to the specific operating environment, access method, level of server activity, and types of applications.
The number of messages that are processed represents actual, billable work by the server. When used together, the MESSAGE, BYTECOUNT, and ACTIVETIME values in the LOG= option report data that characterizes the work that a user asked the server to perform. Here are some examples:
  • Small BYTECOUNT and MESSAGE values and a large ACTIVETIME value might indicate that a small amount of data was selected from a large file by sequentially searching the file or by interpreting a complex view.
  • Moderate or large BYTECOUNT values and a large MESSAGE value might indicate that a small amount of data is being read by the user on each message that is exchanged with the server. This might be caused by random access or exceptionally long observations and might suggest taking a snapshot of the data for the user's analysis.
  • Small ACTIVETIME values and a large BYTECOUNT value suggest that the user is exchanging data “in bulk” with the server. Usually, that does not indicate a problem, but if the server is overloaded, you might want to suggest that the user try another bulk-data transfer technique.

Specifying the Format for the Server Log Datetime Stamp

You can prepend a datetime stamp of a specific format to each message that is written to the server log, or you can suppress the datetime stamp. The default format DATETIME22.3 presents the date and time in the form DDMMMYYYY:hh:mm:ss.ddd.
Here are examples of how to set the datetime stamp:
proc server id=share1 alloc log=cpu dtformat=time11.2;
proc server id=share1 noalloc log=io dtformat=_NODTS_;
Here is an example of a datetime format:
30Apr2003:14:02.39.186

Using the SAS Console Log To Analyze Server Errors

If the SAS/SHARE server encounters problems at SAS initialization or at SAS termination, the server log might not be available to receive error messages. If the server log is not available, error messages are written to the SAS console log. For details about the SAS console log, see the companion documentation that is appropriate for the operating environment that you are using.

Specifying a Time Limit on SAS File Availability for Client Access

The client can specify a maximum time to wait for a SAS file to be unlocked and available for access. In this example, the client specifies a limit of 15 seconds.
libname sales '.' server=shr1 rengine=base
roptions="filelockwait=15";
When you invoke SAS on the computer on which the SAS/SHARE server will run, you can negate the possibility of a stalled server by explicitly setting the maximum wait time to zero. This value will override the value that the client specifies for the FILELOCKWAIT= option in the LIBNAME statement.
c:\Program Files\SAS2\SASFoundation\9.2\sas.exe -dmr -noterminal 
-nosyntaxcheck -sasuser work -icon -nosplash -filelockwaitmax=0