Some features of SAS require that data sets support
different levels at which Update access is used. When a SAS data
set can be opened concurrently by more than one SAS session or by
more than one statement or procedure within a single session, the
level of locking determines how many sessions, procedures, or statements
can read and write to the file at the same time. For example, with
the FSEDIT procedure, you can request two windows on the same SAS
data set in one session. Some engines support this capability; others
do not.
The levels that are
supported are record level and member (data set) level. Member-level
locking enables Read access to many sessions, statements, or procedures.
This locking restricts all other access to the SAS data set when a
session, statement, or procedure acquires update or output access.
Record-level locking enables concurrent Read access and Update access
to the SAS data set by more than one session, statement, or procedure.
This locking prevents concurrent Update access to the same observation.
Not all engines support both levels.
By default, SAS provides
the greatest possible level of concurrent access, while guaranteeing
the integrity of the data. In some cases, you might want to guarantee
the integrity of your data by controlling the levels of Update access
yourself. Use the CNTLLEV= data set option to control levels of locking.
CNTLLEV= enables locking at three levels:
Here are situations
in which you should consider using the CNTLLEV= data set option:
-
Your application controls access
to the data, such as in SAS Component Language (SCL),
SAS/IML software,
or DATA step programming.
-
You access data through an interface
engine that does not provide member-level control of the data.
You can also acquire
an exclusive lock on an existing SAS file by issuing the LOCK global
statement. After an exclusive lock is obtained, no other SAS session
can read or write to the file until the lock is released. For more
information about the LOCK statement, see
SAS Statements: Reference.
Note: SAS products, such as
SAS/ACCESS
and
SAS/SHARE, contain engines that support enhanced session management
services and file locking capabilities.