![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/AF Software: Class Dictionary |
| Terminology |
The Data Form and Data Table classes make use of several key terms and concepts. A SAS data set is a collection of data values organized into a table-like structure. The data values are organized into rows called observations and columns called variables. As needed for clarity, the terms table, row, and column are used to describe the Data Form and Data Table classes instead of the terms data set, observation, and variable.
Relative row number refers to the relative position of the row within the table (ignoring any deleted rows, and taking into account any WHERE clause or index key). Absolute row number refers to the actual physical location of the row within the table (taking into account deleted rows and ignoring and WHERE clause or index key). Absolute row number is not supported by all SAS data files.
| Controlling Execution in the SCL |
Program execution in the SCL entry assigned to a Data Set Data Model object is controlled by grouping statements into sections. Each section of the program begins with an SCL label and ends with a RETURN statement. Data Set Data Model object application programs can include the following six labeled sections:
You cannot assign initial values to columns (variables displayed in the attached viewer, whether computed columns or data set columns) in the DFINIT section. Only columns which are not part of the data display can be initialized in this section because no rows are open during the processing of this block.
The FSEINIT label is synonymous with the DFINIT label; if both labels are present, only the DFINIT label is run.
Note: If the
viewer being used is a table editor,
then the INIT label runs for each row that is displayed in the table. For
example, if the table displays 10 rows, then INIT runs 10 times, executing
the SCL code in it each time. ![[cautend]](../common/images/cautend.gif)
During the main processing phase, the user interacts directly with the application to accomplish specific tasks. The SCL program can prompt the user for information, verify values, check data sets, and call other programs that prompt the user for information.
A typical use of the TERM section is to update an auxiliary data set.
Typical uses of the statements following the DFTERM label are to
The FSETERM label is synonymous with the DFTERM label; if both labels are present, only the DFTERM label is run.
The dataform SCL respects the following SCL CONTROL statement arguments:
See SAS Component Language: Reference for more information on the CONTROL statement.
| Effect of Protecting Columns |
You can prevent users from modifying a column or columns by "protecting" the column or columns. Columns can be protected by using the _protectColumn method or by setting the Protected attribute for that column or columns. Note that the effect of protecting columns is different in a data form than in a data table. If you are using a data form, the effect of protecting a column is that you can type into columns that are protected, but the widgets revert to their previous state when you press enter. In addition, in a data form you cannot tab to or tab out of a protected column. If you are using a data table, the effect of protecting a column is that you can not type into the column at all.
When a data form or data table is in browse mode, all of the columns are protected.
In both the data form and data table, labeled sections for protected columns do not run.
| How are "viewers" and "models" used in Data Form and Data Table? |
The functionality of the Data Form and Data Table classes is accomplished by the use of a model and viewer. The model retrieves data and delivers it to the viewer for display. Generally, the model controls any action that is directly related to the data that is being displayed, for example, the column labels that are used in the form or table, the columns from the table (data set) that are included in the display, which rows for the columns are displayed, and the format associated with the data values. The viewer, on the other hand, controls the display and how users interact with it, for example, the movement within the form or table, including scrolling or paging through the columns.
Because the functionality is accomplished by using both a model and a viewer, the model and viewer must be able to communicate. The term used for this connection is attached, that is the model is attached to the viewer. When you use the Data Form and Data Table classes, the model is automatically attached for you. The model that is used with Data Form and Data Table is the Data Set Data Model class. Because the model is automatically attached, you can call both the model methods and the viewer methods on the data form or data table.
| What is the model SCL? |
The model SCL is separate from the frame's associated SCL entry. The
model SCL entry is associated with a particular data form or data table object.
It initializes computed columns and performs error checking and data validation.
It also allows you to reference the columns by name.
The model SCL for a data form or data table is associated with the data form or data table through the SCL Entry field in the object's attributes window. Specify the name of the model SCL entry in this field.
![[cautend]](../common/images/cautend.gif)
To edit the model SCL for a data form or data table, display the build-mode pop-up menu for the object, select
| Form |
| Table |
| Edit SCL... |
Compile the model SCL for a data form or data table, by using one of the following:
| Form |
| Table |
| Compile SCL |
Note: Compiling the model SCL from the BUILD window
will cause an error at run time. ![[cautend]](../common/images/cautend.gif)
You can use the following three types of variables in your SCL program:
Note: You do not need to declare
these in an SCL program. ![[cautend]](../common/images/cautend.gif)
Each column in the model has a corresponding column variable in SCL. When a user modifies the values in the columns of the object, the values of the corresponding SCL variables are automatically updated. Similarly, when the SCL program modifies the value of a window variable, the value of the corresponding column in the object is updated. If the column is for a data set column, the variable in the data set is updated also.
Noncolumn variables are initialized to missing values or to initial values given in declarative statements (such as ARRAY statements) before SCL is executed.
Note that the following methods cannot be called from the model's SCL entry:
The following methods must be called from the model's SCL entry:
| When are data sets opened? |
The data set associated with a data form or data table is opened at build-time using the mode and level defined in the object attributes window.
| DATAFORM Catalog Entries |
DATAFORM catalog entries can contain column customizations for the following classes: Data Table, Data Form, Table Editor, and Form Editor. In addition, DATAFORM catalog entries also contains layout information for all of these classes.
(For more information on table editors and form editors, see the Table Editor Class and Form Editor Class.)
You can specify that a data table and a data form use the same DATAFORM catalog entry. This approach enables customizations to be shared between both classes with the use of a single catalog entry.
To specify a DATAFORM catalog entry, enter its name in the DATAFORM Entry field of the Data Table or Data Form Attributes window.
![[cautend]](../common/images/cautend.gif)
For example, when you initially open the Attributes window, you can enter the name of a catalog entry in the DATAFORM Entry field or you can leave the field blank. Then, you can make customizations to your frame object. When you return to the Attributes window, you again have an opportunity to enter the name of a catalog entry in the DATAFORM Entry field.
For details on how changing the name of the catalog entry in the DATAFORM entry field can save or lose you customizations, see the following table.
| Before customizations, if the DATAFORM Entry field contains... | After you make customizations and specify a name for the DATAFORM entry as... | Then, the customizations are... |
|---|---|---|
| nothing (blank) | a new DATAFORM catalog entry | saved to the new DATAFORM catalog entry. In a data form, the layout is not changed. |
| nothing (blank) | an existing DATAFORM catalog entry | lost; the object uses any customizations from the existing DATAFORM catalog entry. In a data form, the previous layout is lost and replaced by the saved layout in the new DATAFORM entry. |
| the name of a new DATAFORM catalog entry | another new DATAFORM catalog entry | saved to the new DATAFORM catalog entry that you specify after you make customizations. In a data form, the layout is not changed. |
| the name of a new DATAFORM catalog entry | an existing DATAFORM catalog entry | lost; the object uses any customizations from the existing DATAFORM catalog entry. In a data form, the previous layout is lost and replaced by the saved layout in the new DATAFORM entry. |
| the name of an existing DATAFORM catalog entry | a new DATAFORM catalog entry | lost; the object uses default customizations. In a data form, the previous layout is lost and a new default layout will be created for you. |
| the name of an existing DATAFORM catalog entry | another existing DATAFORM catalog entry | lost; the object uses any customizations from the existing DATAFORM catalog entry that you specify after you make customizations. In a data form, the previous layout is lost and replaced by the saved layout in the new DATAFORM entry. |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.