A
SAS
view defines a virtual data set that is named and stored
for later use. A view contains no data but describes or defines data
that is stored elsewhere. There are three types of SAS views:
You can refer to views
in queries as if they were tables. The view derives its data from
the tables or views that are listed in its FROM clause. The data that
is accessed by a view is a subset or superset of the data that is
in its underlying tables or views.
A PROC SQL view is a
SAS data set of type VIEW that is created by PROC SQL. A PROC SQL
view contains no data. It is a stored query expression that reads
data values from its underlying files, which can include SAS data
files,
SAS/ACCESS views,
DATA step views, other PROC SQL views, or DBMS data. When executed,
a PROC SQL view's output can be a subset or superset of one or
more underlying files.
SAS/ACCESS views and DATA step views are similar to PROC SQL
views in that they are both stored programs of member type VIEW.
SAS/ACCESS views describe data
in DBMS tables from other software vendors. DATA step views are stored
DATA step programs.
Note: Starting in SAS System 9,
PROC SQL views, the pass-through facility, and the
SAS/ACCESS LIBNAME statement are the preferred
ways to access relational DBMS data;
SAS/ACCESS views are no longer recommended. You can convert existing
SAS/ACCESS views to PROC SQL views
by using the CV2VIEW procedure.
For more information,
see Chapter 33, “CV2VIEW Procedure” in SAS/ACCESS for Relational Databases: Reference.
You can use all types
of views as input to DATA steps and procedures.
Note: In this chapter, the term
view collectively
refers to PROC SQL views, DATA step views, and
SAS/ACCESS views, unless otherwise noted.
Note: When
the contents of an SQL view are processed (by a DATA step or a procedure),
the referenced data set must be opened to retrieve information about
the variables that is not stored in the view. If that data set has
a libref associated with it that is not defined in the current SAS
code, then an error will result. You can avoid this error by specifying
a USING clause in the CREATE VIEW statement. See
CREATE VIEW Statement for details.
Note: When
you process PROC SQL views between a client and a server, getting
the correct results depends on the compatibility between the client
and server architecture.
For more information, see “Accessing a SAS View” in Chapter 17 of SAS/CONNECT User's Guide.