Contents
About
Introduction to the SQL Procedure
What Is SQL?
What Is the SQL Procedure?
Terminology
Comparing PROC SQL with the SAS DATA Step
Notes about the Example Tables
Retrieving Data from a Single Table
Overview of the SELECT Statement
Selecting Columns in a Table
Creating New Columns
Sorting Data
Retrieving Rows That Satisfy a Condition
Summarizing Data
Grouping Data
Filtering Grouped Data
Validating a Query
Retrieving Data from Multiple Tables
Introduction
Selecting Data from More Than One Table by Using Joins
Using Subqueries to Select Data
When to Use Joins and Subqueries
Combining Queries with Set Operators
Creating and Updating Tables and Views
Introduction
Creating Tables
Inserting Rows into Tables
Updating Data Values in a Table
Deleting Rows
Altering Columns
Creating an Index
Deleting a Table
Using SQL Procedure Tables in SAS Software
Creating and Using Integrity Constraints in a Table
Creating and Using PROC SQL Views
Programming with the SQL Procedure
Introduction
Using PROC SQL Options to Create and Debug Queries
Improving Query Performance
Accessing SAS System Information by Using DICTIONARY Tables
Using SAS Data Set Options with PROC SQL
Using PROC SQL with the SAS Macro Facility
Formatting PROC SQL Output by Using the REPORT Procedure
Accessing a DBMS with SAS/ACCESS Software
Using the Output Delivery System with PROC SQL
Practical Problem-Solving with PROC SQL
Overview
Computing a Weighted Average
Comparing Tables
Overlaying Missing Data Values
Computing Percentages within Subtotals
Counting Duplicate Rows in a Table
Expanding Hierarchical Data in a Table
Summarizing Data in Multiple Columns
Creating a Summary Report
Creating a Customized Sort Order
Conditionally Updating a Table
Updating a Table with Values from Another Table
Creating and Using Macro Variables
Using PROC SQL Tables in Other SAS Procedures
Recommended Reading
Glossary
Product
Release
Base SAS
9.2
Type
Usage and Reference
Copyright Date
February 2009
Last Updated
26Feb2009