A SAS data
set is a file structured in a format that SAS can access. The physical
object contains the following elements:
-
data values that are stored in
tabular form
-
a descriptor portion that defines
the types of data to SAS
The physical
locations of the data values and the descriptor are not necessarily
contiguous.
SAS data sets
have two forms: data files and data views. SAS data files are relational
tables with columns (or variables) and rows (or observations). The
SAS data file structure can have many of the characteristics of a
DBMS, including indexing, compression, and password protection.
SAS data
views are definitions or descriptions of data that resides elsewhere.
SAS data views enable you to use SAS to access many different data
sources, including flat files, VSAM files, and DBMS structures, as
well as native SAS data files. A data view eliminates the need to
know anything about the structure of the data or the software that
created it. Data views need very little storage because they contain
no data. They access the most current data from their defined sources
because they collect the actual data values only when they are called.
You can
use data views to define subsets of larger structures, or supersets
of data that have been enhanced with calculated values. You can create
SAS data views that combine views of dissimilar data sources. For
example, you can combine a view of a relational DB2 table with a view
of a SAS data file, a view of hierarchical IMS data, or even a view
from a PC-based dBASE file.
You create
SAS data views in three ways:
-
with the DATA step (DATA step views)
-
with the SQL procedure (PROC SQL
views)
-
with
SAS/ACCESS software (
SAS/ACCESS
views)
You can use
SAS/ACCESS software to work directly with DBMS tables, such as
DB2 and Oracle, as if they were SAS data sets and data views by using
the
SAS/ACCESS LIBNAME statement.
For more information, see
SAS/ACCESS for Relational Databases: Reference.
These
data views have some variation:
describe data from
one or more sources, including flat files, VSAM files, and SAS data
sets (either data files or other data views). You cannot use a DATA
step view to update the view's underlying data because DATA step views
only read other files.
For more information
about how to create and use DATA step views, see “DATA Step
Views,” in
SAS Language Reference: Concepts .
define either a subset
or a superset of data from one or more SAS data sets. These data sets
can be data files or data views, and can include data sets composed
of DBMS data that are created with the SAS/ACCESS LIBNAME statement, and data views that are created
with the SQL Pass-Through Facility to access DBMS data. You can also
create PROC SQL views of DBMS data by using an embedded LIBNAME statement.
For example, an SQL
procedure can combine data from PROC SQL views, DATA step views, and
SAS/ACCESS views with data in
a SAS data file. You cannot use a PROC SQL view to update the view's
underlying files or tables. However, with some restrictions, you can
use the UPDATE, DELETE, and INSERT statements in the SQL procedure
to update data that is described by
SAS/ACCESS views.
For more information
about the SQL Pass-Through Facility, see “Overview: SQL Procedure,”
in
Base SAS Procedures Guide .