Storing Files in a SAS Library
What Is a SAS File?
You store all SAS files in a SAS library. A SAS file is a specially structured file that is
created, organized, and maintained by SAS. The files reside in SAS libraries as members
with specific types. Examples of SAS files are as follows:
• SAS data sets (which can be SAS data files or SAS data views)
• SAS catalogs
• SAS/ACCESS descriptor files
• stored compiled DATA step programs
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.
Understanding SAS Data Sets
A SAS data set is a SAS file that is stored in a SAS 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 be
associated with an index. 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 you would 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:
• DATA step views
• SAS/ACCESS views
• PROC SQL 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.
690 Chapter 35 • Understanding SAS Libraries