CNTLLEV= Data Set Option

Specifies the level of shared access to a SAS data set.

Valid in: DATA step and PROC steps
Category: Data Set Control
Restriction: Specify for input data sets only.

Syntax

CNTLLEV=LIB | MEM | REC

Syntax Description

LIB

specifies that concurrent access is controlled at the library level. Library-level control restricts concurrent access to only one update process to the library.

MEM

specifies that concurrent access is controlled at the SAS data set (member) level. Member-level control restricts concurrent access to only one update or output process to the SAS data set. If the data set is open for an update or output process, then no other operation can access the data set. If the data set is open for an input process, then other concurrent input processes are allowed, but no update or output process is allowed.

REC

specifies that concurrent access is controlled at the observation (record) level. Record-level control allows more than one Update access to the same SAS data set, but it denies concurrent update of the same observation.

Details

The CNTLLEV= option specifies the level at which shared Update access to a SAS data set is denied. A SAS data set can be opened concurrently by more than one SAS session or by more than one statement, window, or procedure within a single session. By default, SAS procedures allow the greatest degree of concurrent access possible, and they guarantee the integrity of the data and the data analysis. Therefore, you typically use the CNTLLEV= data set option in these situations:
  • when your application controls the access to the data, such as in SAS Component Language (SCL), SAS/IML software, or DATA step programming
  • when you access data through an interface engine that does not provide member-level control of the data.
If you use CNTLLEV=REC and the SAS procedure needs member-level control for integrity of the data analysis, SAS prints a warning to the SAS log. The warning states that inaccurate or unpredictable results can occur if the data is updated by another process during the analysis.

Example: Changing the Shared Access Level

In this example, the first SET statement includes the CNTLLEV= data set option in order to override the default level of shared access from member-level control to record-level control. The second SET statement opens the SAS data set with the default member-level control.
set datalib.fuel (cntllev=rec) point=obsnum;
   .
   .
   .
set datalib.fuel;
   by area;