Chapter Contents |
Previous |
Next |
SAS Component Language: Reference |
Querying Attributes of SAS Tables |
SAS tables have a variety of numeric and character attributes associated with them. These attributes can provide some basic information to your SCL program. For example, to determine the number of columns in an existing SAS table, use the NVARS argument with the ATTRN function. For a list of other table attributes and how to retrieve them, see ATTRC and ATTRN.
Querying Attributes of SAS Table Columns |
name | VARNAME function |
number | VARNUM function |
data type | VARTYPE function |
length | VARLEN function |
label | VARLABLE function |
format | VARFMT function |
informat | VARINFMT function. |
Defining New Columns |
After determining the name, type, length,
label, format, and
informat of each column, you can add a new column that has these attributes
to the column list for a new SAS table. To do this, first use the OPEN function
with the
N
argument (for NEW mode), and then use the NEWVAR
function.
N
argument
(for NEW mode), the OPEN function replaces an existing SAS table that has
the same name. If you do not want to delete an existing SAS table by opening
it in NEW mode, then use the EXIST function to confirm that the table does
not exist before using OPEN to create a new SAS table.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.