Previous Page | Next Page

Understanding SAS Data Libraries

Storing Files in a SAS Data Library


What Is a SAS File?

You store all SAS files in a SAS data library. A SAS file is a specially structured file that is created, organized, and maintained by SAS. The files reside in SAS data libraries as members with specific types. Examples of SAS files are as follows:

Note:   A file that contains SAS statements, even one that is created during a SAS session, is usually not considered a SAS file. For example, in directory-based operating environments, a .sas file is a text file that typically contains a program and is not considered a SAS file.  [cautionend]


Understanding SAS Data Sets

A SAS data set is a SAS file that is stored in a SAS data library that consists of descriptor information. Descriptor information identifies the attributes of a SAS data set and its contents, and data values that are organized as a table of observations (rows) and variables (columns). A SAS data set can be either a SAS data file or a SAS data view.

If the descriptor information and the observations are in the same physical location, then the data set is a SAS data file, which has a member type DATA. A SAS data file can have an index associated with it. One purpose of an index is to optimize the performance of WHERE processing. Basically, an index contains values in ascending order for a specific variable or variables. The index also includes information about the location of those values within observations in the SAS data file.

If the descriptor and the observations are stored separately, then they form a SAS data view, which has a member type VIEW. The observations in a SAS data view might be stored in a SAS data file, an external database, or an external file. The descriptor contains information about where the data is located and which observations and variables to process. You use a view like a SAS data file. You might use a view when you need only a subset of a large amount of data. In addition to saving storage space, views simplify maintenance because they automatically reflect any changes to the data. There are three types of SAS data views:

Note:   SAS data views usually behave like SAS data files. Other topics in this documentation do not distinguish between the two types of SAS data sets.  [cautionend]


Understanding Other SAS Files

In addition to SAS data sets, a SAS data library can contain the following types of SAS files:

SAS catalog

is a SAS file that stores many kinds of information, in separate units called catalog entries. Each entry is distinguished by an entry name and an entry type. Some catalog entries contain system information such as key definitions. Other catalog entries contain application information about window definitions, help windows, formats, informats, macros, or graphics output. A SAS catalog has a member type CATALOG.

SAS/ACCESS descriptor

is a SAS file that contains information about the layout of an external database. SAS uses this information in order to build a SAS data view in which the observations are stored in an external database. An access descriptor has a member type ACCESS.

stored compiled DATA step program

is a SAS file that contains a DATA step, which has been compiled and stored in a SAS data library. A stored compiled DATA step program has a member type PROGRAM.

Complete discussion of all SAS files, except SAS data sets, is beyond the scope of this section. For more information about SAS files, see SAS Language Reference: Concepts.

Previous Page | Next Page | Top of Page