Chapter Contents

Previous

Next
SAS Component Language: Reference

SAS Table and SCL Data Vectors

When an application opens a SAS table, its TDV is empty. However, to enable the program to work with the SAS table columns, SCL provides functions for copying table rows one at a time from the SAS table to the TDV. Once column values for a row are in the TDV, you can copy these values into the SCL data vector (SDV), and the application can manipulate the column values.

Before you can display or manipulate the values of SAS table columns, those columns must be linked to SCL variables through the TDV and the SDV. Special SCL functions and storage locations facilitate the transfer of values between SAS table columns and SCL variables. Path of Data in SAS Table "Read" and "Write" Operations illustrates the SDV and TDV that are created for an application that opens a SAS table. This figure shows the paths that rows take when they are read from the table, displayed in the window, processed, and then returned to the table.

Path of Data in SAS Table "Read" and "Write" Operations

[IMAGE]

Two steps are required in order to transfer data from an open SAS table to an SCL program:

  1. The values of the columns in a row in the open SAS table are copied into the TDV.

  2. The values of the columns in the TDV are copied to the SDV, which contains all of the SCL variables (window variables, nonwindow variables, system variables, and so on). The transfer of data from the TDV to the SDV can be either automatic (when the SET routine is used) or under program control (when the GETVARC or GETVARN functions are used).

Once the values are in the SDV, you can manipulate them by using SCL statements. Two steps are also required in order to transfer data from an SCL program to an open SAS table:

  1. The column values in the SDV are transferred to the TDV. The transfer of data from the SDV to the TDV can be either automatic (when the SET routine is used) or under program control (when PUTVARC or PUTVARN is used).

  2. The values in the TDV are written to the columns in a row in the open table.


Access Control Levels

When a SAS table is opened, SAS software determines the control level for the table. The control level determines the extent to which access to the table is restricted. For example, an application may be able to gain exclusive update access to the entire SAS table, or it may be able to gain exclusive update access to only the row that is currently in use. In either case, there are ramifications for any users or applications that need to access the SAS table at the same time. You can open a SAS table with one of the following control levels:

RECORD
provides exclusive update access only to the SAS table row that is currently in the TDV (as with the FETCH and FETCHOBS functions). With this control level, the same user can open the same SAS table multiple times (multiple concurrent access). In addition, if SAS/SHARE software is used, then multiple users can open the same SAS table simultaneously for browsing or for editing. For more information, see SAS/SHARE User's Guide.

MEMBER
provides exclusive update access to an entire SAS table. While this control level is in effect, no other user can open the table, and the same user cannot open the table multiple times.


Specifying a Control Level

When you use the OPEN function to open a SAS data set in UPDATE mode, by default the table is opened with RECORD-level control. However, in SCL you can use the OPEN function with the SAS data set option CNTLLEV= to set the control level when a SAS table opens. See OPEN for more information.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.