space
Previous Page | Next Page

Locking SAS Data Objects

Defaults for Selected SAS Operations


Default Data Objects: Reference

Knowledge of the default data objects and how they are accessed will help you to anticipate the results from specific operations when you write your application or issue SAS statements in interactive mode. Defaults for Selected SAS Operations shows the defaults for some frequently used SAS operations when locking is executed.

Defaults for Selected SAS Operations
SAS Operation What the Data Object Is Locked For The Data Object Locked (Default)
DATA step


DATA statement




without MODIFY statement Output Member



with MODIFY statement Update Observation

SET statement




without POINT= and KEY= options Input Observation



with POINT= and KEY= options Input Member

MERGE statement Input Observation

MODIFY statement




without POINT= and KEY= options Update Observation



with POINT= and KEY= options Update Member

UPDATE statement Input Observation
Procedures


APPEND procedure



BASE= option Update Member* or observation


DATA= option Input Observation

COPY procedure



IN= option Input Observation


IN= option with MOVE option Output Observation


OUT= option Output Member

FSBROWSE procedure



DATA= option Input Observation

FSEDIT procedure



DATA= option Update Observation

FSVIEW procedure



DATA= option without EDIT option Input Observation


DATA= option with EDIT option Update Observation

PRINT procedure



DATA= option Input Observation


UNIFORM= option Input Member

SORT procedure



DATA= option Input Observation


OUT= option Output Member

SQL procedure



CREATE TABLE statement Output Member


DELETE statement Update Observation


INSERT statement Update Member


UPDATE statement Update Member
* If no other tasks are currently accessing the BASE= data set, then PROC APPEND opens the data set with a member lock.


Changing the Data Set Option Default Object

In some SAS operations, you can change the SAS data set option default object. When the syntax of a statement or a command allows you to specify SAS data set options, you can use the CNTLLEV= option to override the default object and to specify the object that you want. For example, in a SET statement that contains the POINT= option, you can change the default from member to observation by specifying the CNTLLEV= data set option. In this example, the value, REC (for record), means the same as observation.

set datalib.fuel (cntllev=rec) point=obsnum;

Note:   If you make this change, the values in a specific observation might differ each time that you read the observation.  [cautionend]

You can also change the data object observation to member. You might do this to ensure that a data set does not change while you are processing it. For example, if you use a SET statement with a BY statement and you cannot use an index to retrieve the observations in sorted order, you can use the CNTLLEV= option to reset the data object observation to member.

set datalib.fuel (cntllev=mem);
by area;

In some SAS operations, you cannot override the default setting because the statement or the command requires it. For example, a DATA statement requires a member setting when the MODIFY statement is omitted from the DATA step. Without the MODIFY statement, the data set that is specified in the DATA statement must be opened for output. Therefore, even if you specify CNTLLEV=REC in such a DATA statement, the DATA step tries to set the data object as member, but this will fail if other operations are accessing the data set.

Note:   Be careful when using the CNTLLEV= option in a procedure. Some procedures make multiple passes through an input data set and require that the data remains the same to guarantee the integrity of the output. If a procedure has this requirement, a warning is issued but the procedure will allow its objects to be reset if you use the CNTLLEV= option.  [cautionend]

For details about the syntax of the CNTLLEV= option in the SET statement, see the CNTLLEV= data set option in SAS Language Reference: Dictionary.

space
Previous Page | Next Page | Top of Page