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

Chapter 1
Introduction to the SQL Procedure
What Is SQL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
What Is the SQL Procedure? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Null Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Comparing PROC SQL with the SAS DATA Step . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Notes about the Example Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
What Is SQL?
Structured Query Language (SQL) is a standardized, widely used language that retrieves
and updates data in relational tables and databases.
A relation is a mathematical concept that is similar to the mathematical concept of a set.
Relations are represented physically as two-dimensional tables that are arranged in rows
and columns. Relational theory was developed by E. F. Codd, an IBM researcher, and
first implemented at IBM in a prototype called System R. This prototype evolved into
commercial IBM products based on SQL. The Structured Query Language is now in the
public domain and is part of many vendors' products.
What Is the SQL Procedure?
The SQL procedure is the Base SAS implementation of Structured Query Language.
PROC SQL is part of Base SAS software, and you can use it with any SAS data set
(table). Often, PROC SQL can be an alternative to other SAS procedures or the DATA
step. You can use SAS language elements such as global statements, data set options,
functions, informats, and formats with PROC SQL just as you can with other SAS
procedures. PROC SQL enables you to perform the following tasks:
generate reports
generate summary statistics
3

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