Getting Started with the SAS System Using SAS/ASSIST Software |
A table is a collection of information, as shown in the sample table in the following figure. A SAS
table stores data in a form that the SAS System can use.
Parts of a SAS Table
This diagram shows part of the HOUSES sample table that
contains information on houses for sale including the house style, square footage, number of bedrooms, and number of bathrooms. The HOUSES table is one of the SAS/ASSIST sample tables; see
Creating the Sample Tables for details on creating the sample tables.
A table name can be one to 32 characters in length. It must start with an uppercase or lowercase letter (A through Z,
a through z) or an underscore (_), but it can otherwise contain
any combination of uppercase and lowercase letters, numbers, and underscores. Note, however, that the mixed-case capability of table names is for display purposes only; SAS software does not
distingush between, for example, the names "Dog," "DOG," and "dog." Also, due to window space considerations, some table name entry fields in SAS/ASSIST software do
not allow you to enter more than eight characters.
A table consists of the following components:
-
data values
- A data value is a single unit of information, such as the square footage for one
house.
-
columns
- A column is a set of data values that represents a particular type of data, for example, the price of all the
houses.
A column can be character or numeric. A character column contains data values that can consist of any combination of letters, numbers, and
special characters. A numeric column contains values that consist only of numbers and related symbols such as decimal points, plus signs, and minus signs. If you are going to
perform arithmetic calculations on a column, the column must be numeric.
A column name can be one to 32 characters in length. It must start with an uppercase or lowercase
letter (A through Z, a through z) or an underscore (_), but it can otherwise contain any combination of uppercase and lowercase letters, numbers, and underscores. Note, however, that the mixed-case
capability of column names is for display purposes only; SAS software does not distingush between, for example, the names "Dog," "DOG," and "dog." Also, due to
window space considerations, some column name entry fields in SAS/ASSIST software do not allow you to enter more than eight
characters.
-
rows
- A row is a set of data values for the same item, for example, all the information about one house, such as price, style, square footage, and so
on.
Older versions of SAS/ASSIST software use the terms data set,
observation,
and variable for table, row, and column, respectively. You may encounter these terms in other SAS Institute products and documentation.
A SAS data library
is used to store and manage data in SAS files. It is a collection of one or more SAS files, such as a SAS table, that is recognized by the SAS System. Each file is a member in a
library.
A libref is the name you associate with the SAS data library. You assign a libref to each SAS data
library that you need to access. Then you reference files in the library by using the corresponding libref in your SAS task. A libref can be one
to eight characters in length. It must start with a letter (A through Z) or an underscore (_), but it can otherwise contain any combination of letters, numbers, and
underscores.
After you establish a libref for a SAS data library, you use the libref throughout your SAS session so that the SAS System knows where to look for SAS files
that already exist or where to store new SAS files that you create.
|
Data Files and Data Views |
A SAS table can be one of two member types: DATA or VIEW. A SAS table of
type DATA contains descriptor information and data values and is called a SAS data file. A SAS table of type VIEW contains descriptor information that points to the data values,
but it does not contain the actual data values. It is called a SAS data view. A SAS data view differs from a SAS data file in that
it only contains a description of data that is stored elsewhere. The data itself is stored in other SAS data files, in another software vendor's database management system (DBMS), or in external
files. For more information on creating and using SAS data views, see SAS Language Reference: Concepts and SAS/ACCESS Software for Relational Databases:
Reference.
Both data files and data views can be used in the same way, and in most cases it does not matter whether the data comes from a data file or from a data
view.
All examples in this book use SAS data files.
|
Temporary and Permanent Tables |
The SAS System creates two types of tables: temporary tables and permanent tables. A temporary SAS table exists only for the duration of
the current SAS session. A permanent SAS table exists after the end of the current SAS session and until you delete it.
Temporary SAS tables are
automatically assigned to a library called WORK, which is deleted when you exit SAS software. Permanent SAS tables are members of a previously defined SAS data
library.
Both types of SAS tables have two-level names in the form of libref.table-name. When you create or refer to a permanent SAS table, you must specify
both the libref and the table name. When you create or refer to a temporary SAS table, you may either specify the WORK libref or specify the table name only; if you specify the table name only, SAS
software uses the WORK libref.
A SAS catalog is a SAS file that stores many different
kinds of information in smaller units called catalog entries. Catalog entries are identified by name and type. For example, a saved SAS/ASSIST task is a catalog entry of type ASSIST, and
has a name that is one to eight characters long. Like a SAS table, a SAS catalog must be associated with a SAS library, and is identified with a two-level name in the form of
libref.catalog-name.
|
Operating Environment Specific Information |
The following sections discuss some of the operating environment specifics for SAS data
libraries. For more information about SAS libraries, refer to the SAS companion documentation for your operating environment.
Directory-based Operating Environments (Microsoft Windows, OS/2, UNIX, OpenVMS)
In a directory-based operating environment like Microsoft Windows,
OS/2, UNIX, or OpenVMS, a SAS data library is a group of SAS files in one or more directories. Any directory can become a SAS data library when SAS files are stored in that directory. However,
since the SAS data library is a logical grouping of tables, and not an actual physical grouping, external files stored in the same directory are unaffected by the SAS data
library.
The form of the SAS table name under a directory-based operating environment is libref.filename.
You use the Assign a New
Libref action in SAS/ASSIST software to associate a libref with a SAS data library. You will find instructions for assigning a libref later in this chapter.
OS/390 Operating Environment
Under the OS/390 (formerly known as MVS) operating environment, a SAS data library is implemented both
logically and physically as a specially formatted operating environment table that contains only SAS files. Each SAS file is a member of the library, and each member has a
member type that identifies the type of SAS file it represents, such as data, catalog, or access.
The form of the SAS table name under
OS/390 is libref.member.
You use the Assign a New Libref action in SAS/ASSIST software to associate a libref with a SAS data library. You will find
instructions for assigning a libref later in this chapter.
If you are referencing or creating an OE-data-set-name that has not been allocated by the OS/390
operating environment, the SAS System prompts you about whether you want to allocate the file and then allocates it for you.
CMS Operating Environment
Under the CMS operating environment, CMS identifies a SAS file the same way it identifies any other file:
with a three-part name that consists of the file name, file type, and file mode, for example, TEST MYLIB A. The SAS System identifies a SAS file by a two-level name, for example, MYLIB.TEST. The
first part of the name is the libref, and the second part of the name is the filename. With SAS naming conventions, the SAS libref usually corresponds to the CMS file type. The second-level SAS name
corresponds to the CMS file name. For example, if the SAS data file MYLIB.TEST is on your A disk, the corresponding CMS file id would be TEST MYLIB A.
The form of the SAS
table name under CMS is libref.filename (where libref is the file type).
You use the Assign a New Libref action in SAS/ASSIST software to
associate a libref with a SAS data library. You will find instructions for assigning a libref in the following section.
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.