O'Reilly logo

SAS 9.4 SQL Procedure User's Guide, Fourth Edition, 4th Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

retrieve data from tables or views
combine data from tables or views
create tables, views, and indexes
update the data values in PROC SQL tables
update and retrieve data from database management system (DBMS) tables
modify a PROC SQL table by adding, modifying, or dropping columns
PROC SQL can be used in an interactive SAS session or within batch programs, and it
can include global statements, such as TITLE and OPTIONS.
Terminology
Tables
A PROC SQL table is the same as a SAS data file. It is a SAS file of type DATA. PROC
SQL tables consist of rows and columns. The rows correspond to observations in SAS
data files, and the columns correspond to variables. The following table lists equivalent
terms that are used in SQL, SAS, and traditional data processing.
Table 1.1 Comparing Equivalent Terms
SQL Term SAS Term Data Processing Term
table SAS data file file
row observation record
column variable field
You can create and modify tables by using the SAS DATA step, or by using the PROC
SQL statements that are described in Chapter 4, “Creating and Updating Tables and
Views,” on page 111. Other SAS procedures and the DATA step can read and update
tables that are created with PROC SQL.
SAS data files can have a one-level name or a two-level name. Typically, the names of
temporary SAS data files have only one level, and the data files are stored in the Work
library. PROC SQL assumes that SAS data files that are specified with a one-level name
are to be read from or written to the Work library, unless you specify a User library. You
can assign a User library with a LIBNAME statement or with the SAS system option
USER=. For more information about how to work with SAS data files and libraries, see
“Temporary and Permanent SAS Data Sets” in Base SAS Procedures Guide.
DBMS tables are tables that were created with other software vendors' database
management systems. PROC SQL can connect to, update, and modify DBMS tables,
with some restrictions. For more information, see “Accessing a DBMS with
SAS/ACCESS Software” on page 167.
4 Chapter 1 Introduction to the SQL Procedure

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required