The SERVER Procedure |
Valid In: | PROC step |
Tip: | Keeping SAS data sets open can improve server performance by reducing the overhead that normally occurs when users open and close the data sets during application processing. A file remains open until the program or SAS session ends. |
Syntax |
ALLOCATE SASFILE SAS-data-set1 <(data-set-options) >
<SAS-data-set2 <(data-set-options)> ... SAS-data-set8 <(data-set-options)>>; |
Arguments |
contains descriptor information and its related data values organized as a table of observations and variables that can be processed by SAS.
specify actions that apply only to the SAS data set with which they appear. For complete details about data set options, see SAS Language Reference: Dictionary.
Note: You must define all librefs before using them in an ALLOCATE SASFILE command.
ALLOCATE SASFILE Command Considerations |
Consider the following when using the ALLOCATE SASFILE command with the PROC SERVER statement:
A maximum of 8 SAS data set names can be specified in each ALLOCATE SASFILE command.
The SAS data sets that you specify must exist before the ALLOCATE SASFILE command is issued.
Only SAS data sets can be specified. Other types of SAS files (for example, catalogs) cannot be specified in an ALLOCATE SASFILE command.
When you open a SAS data set by using the ALLOCATE SASFILE command, the file is opened for input processing and can be used for subsequent input or update processing. However, the file cannot be used for subsequent utility or output processing, because utility and output processing require exclusive access to the file (member-level locking). For example, you cannot replace the file or rename its variables.
The ALLOCATE SASFILE command can execute only in the server session.
After the ALLOCATE SASFILE command executes, all users who subsequently open the file will access the data that is held in memory instead of the data that is stored on the disk.
After the ALLOCATE SASFILE command executes, the file is closed and the buffers are freed only after the SAS/SHARE server is terminated.
Do not specify the same data set in both a SASFILE statement and an ALLOCATE SASFILE command.
You must execute the SASFILE statement before you execute the PROC SERVER statement.
Comparison: ALLOCATE SASFILE Command and SASFILE Statement |
The ALLOCATE SASFILE command is similar and complementary to the SASFILE statement in Base SAS. The SASFILE statement can be used in a server session as well as in a single-user session. Both statements used in a server session achieve performance gains by providing in-memory processing using buffers.
A buffer is a reserved area of memory that holds a segment of data while it is processed. The number of allocated buffers determines how much data can be held in memory at one time.
The ALLOCATE SASFILE command offers limited buffering. The SASFILE statement in Base SAS provides maximum buffering, and therefore, the best performance. You can specify any of the following four levels of file buffering (shown in Levels of File Buffering) for each data set.
Level of File Buffering | Memory Consumed | Condition for Using |
---|---|---|
Neither the ALLOCATE SASFILE command nor the SASFILE statement is used. | The least amount of memory is consumed. Each client that accesses a file duplicates the same overhead that is required for a file open. | File access is limited and memory is constrained. |
Use the ALLOCATE SASFILE command, and accept the default number of buffers that are pre-allocated. | The SAS/SHARE server opens the file and keeps it open for all client access, which eliminates the duplicate overhead that is required for a file open. | File access is frequent and memory is constrained. |
Use the ALLOCATE SASFILE command, and use the BUFNO= data set option to specify the number of buffers to pre-allocate. | Specify buffers according to available memory and the usage pattern of the file. | The file being accessed is large, but only certain pages of the data are accessed frequently. |
Use the SASFILE statement to read the entire data set into memory. | The entire file resides in memory. | File access is frequent and there is sufficient memory for reading in the entire file. |
For details about the SASFILE statement in Base SAS, see the following topics in SAS Language Reference: Dictionary: the BUFNO= system option, the BUFNO= data set option, and the SASFILE statement.
Example |
In the following example, server SHARE1 is started and eight data sets are specified to be stored in memory for client access. The number of buffers that are used is determined by the default value of the BUFNO= system option.
proc server id=share1; allocate sasfile sas-dataset1 sas-dataset2 ... sas-dataset8; run;
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.