Book description
Describes the basics of using the SQL procedure and provides comprehensive reference information. The usage information includes retrieving data from single and multiple tables; selecting specific data from tables; subsetting, ordering, and summarizing data; updating tables; combining tables to create new tables and useful reports; performing queries on database management system (DBMS) tables; using PROC SQL with the SAS macro facility; and debugging and optimizing PROC SQL code. The reference information includes statements, dictionary components, and system options.
Table of contents
- Contents
- About This Book
- What's New in the SAS 9.4 SQL Procedure
-
Using the SQL Procedure
- Introduction to the SQL Procedure
-
Retrieving Data from a Single Table
- Overview of the SELECT Statement
- Selecting Columns in a Table
- Creating New Columns (1/2)
- Creating New Columns (2/2)
- Sorting Data (1/2)
- Sorting Data (2/2)
- Retrieving Rows That Satisfy a Condition (1/3)
- Retrieving Rows That Satisfy a Condition (2/3)
- Retrieving Rows That Satisfy a Condition (3/3)
- Summarizing Data (1/2)
- Summarizing Data (2/2)
- Grouping Data
- Filtering Grouped Data
- Validating a Query
-
Retrieving Data from Multiple Tables
- Introduction
- Selecting Data from More Than One Table By Using Joins (1/5)
- Selecting Data from More Than One Table By Using Joins (2/5)
- Selecting Data from More Than One Table By Using Joins (3/5)
- Selecting Data from More Than One Table By Using Joins (4/5)
- Selecting Data from More Than One Table By Using Joins (5/5)
- Using Subqueries to Select Data (1/2)
- Using Subqueries to Select Data (2/2)
- When to Use Joins and Subqueries
- Combining Queries with Set Operators (1/2)
-
Combining Queries with Set Operators (2/2)
- Working with Two or More Query Results
- Producing Unique Rows from Both Queries (UNION)
- Producing Rows That Are in Only the First Query Result (EXCEPT)
- Producing Rows That Belong to Both Query Results (INTERSECT)
- Concatenating Query Results (OUTER UNION)
- Producing Rows from the First Query or the Second Query
-
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 (1/2)
- Creating and Using PROC SQL Views (2/2)
-
Programming with the SQL Procedure
- Introduction
-
Using PROC SQL Options to Create and Debug Queries
- Overview of Using PROC SQL Options to Create and Debug Queries
- Restricting Row Processing with the INOBS= and OUTOBS= Options
- Limiting Iterations with the LOOPS= Option
- Checking Syntax with the NOEXEC Option and the VALIDATE Statement
- Expanding SELECT * with the FEEDBACK Option
- Timing PROC SQL with the STIMER Option
- Resetting PROC SQL Options with the RESET Statement
-
Improving Query Performance
- Overview of Improving Query Performance
- Using Indexes to Improve Performance
- Using the Keyword ALL in Set Operations
- Omitting the ORDER BY Clause When Creating Tables and Views
- Using In-Line Views versus Temporary Tables
- Comparing Subqueries with Joins
- Using WHERE Expressions with Joins
- Optimizing the PUT Function
- Replacing References to the DATE, TIME, DATETIME, and TODAY Functions
- Disabling the Remerging of Data When Using Summary Functions
- Using Column Aliases
- Accessing SAS System Information By Using DICTIONARY Tables (1/2)
- Accessing SAS System Information By Using DICTIONARY Tables (2/2)
- Using SAS Data Set Options with PROC SQL
- Using PROC SQL with the SAS Macro Facility (1/2)
- Using PROC SQL with the SAS Macro Facility (2/2)
- Formatting PROC SQL Output By Using the REPORT Procedure
- Accessing a DBMS with SAS/ACCESS Software (1/2)
- Accessing a DBMS with SAS/ACCESS Software (2/2)
- 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
-
SQL Procedure Reference
-
SQL Procedure
- Overview
- Syntax: SQL Procedure (1/11)
- Syntax: SQL Procedure (2/11)
- Syntax: SQL Procedure (3/11)
- Syntax: SQL Procedure (4/11)
- Syntax: SQL Procedure (5/11)
- Syntax: SQL Procedure (6/11)
- Syntax: SQL Procedure (7/11)
- Syntax: SQL Procedure (8/11)
- Syntax: SQL Procedure (9/11)
- Syntax: SQL Procedure (10/11)
-
Syntax: SQL Procedure (11/11)
- PROC SQL Statement
- ALTER TABLE Statement
- CONNECT Statement
- CREATE INDEX Statement
- CREATE TABLE Statement
- CREATE VIEW Statement
- DELETE Statement
- DESCRIBE Statement
- DISCONNECT Statement
- DROP Statement
- EXECUTE Statement
- INSERT Statement
- RESET Statement
- SELECT Statement
- SELECT Clause
- INTO Clause
- FROM Clause
- WHERE Clause
- GROUP BY Clause
- HAVING Clause
- ORDER BY Clause
- UPDATE Statement
- VALIDATE Statement
- Examples: SQL Procedure (1/10)
- Examples: SQL Procedure (2/10)
- Examples: SQL Procedure (3/10)
- Examples: SQL Procedure (4/10)
- Examples: SQL Procedure (5/10)
- Examples: SQL Procedure (6/10)
- Examples: SQL Procedure (7/10)
- Examples: SQL Procedure (8/10)
- Examples: SQL Procedure (9/10)
-
Examples: SQL Procedure (10/10)
- Creating a Table and Inserting Data into It
- Creating a Table from a Query's Result
- Updating Data in a PROC SQL Table
- Joining Two Tables
- Combining Two Tables
- Reporting from DICTIONARY Tables
- Performing an Outer Join
- Creating a View from a Query’s Result
- Joining Three Tables
- Querying an In-Line View
- Retrieving Values with the SOUNDS-LIKE Operator
- Joining Two Tables and Calculating a New Value
- Producing All the Possible Combinations of the Values in a Column
- Matching Case Rows and Control Rows
- Counting Missing Values with a SAS Macro
-
SQL Procedure Components
- Overview
- Dictionary (1/11)
- Dictionary (2/11)
- Dictionary (3/11)
- Dictionary (4/11)
- Dictionary (5/11)
- Dictionary (6/11)
- Dictionary (7/11)
- Dictionary (8/11)
- Dictionary (9/11)
- Dictionary (10/11)
-
Dictionary (11/11)
- BETWEEN Condition
- BTRIM Function
- CALCULATED
- CASE Expression
- COALESCE Function
- column-definition
- column-modifier
- column-name
- CONNECTION TO
- CONTAINS Condition
- EXISTS Condition
- IN Condition
- IS Condition
- joined-table
- LIKE Condition
- LOWER Function
- query expression
- sql-expression
- SUBSTRING Function
- summary-function
- table-expression
- UPPER Function
-
SQL Procedure
-
Appendixes
- SQL Macro Variables and System Options
- PROC SQL and the ANSI Standard (1/2)
- PROC SQL and the ANSI Standard (2/2)
- Example Code Shown in Using the SQL Procedure (1/10)
- Example Code Shown in Using the SQL Procedure (2/10)
- Example Code Shown in Using the SQL Procedure (3/10)
- Example Code Shown in Using the SQL Procedure (4/10)
- Example Code Shown in Using the SQL Procedure (5/10)
- Example Code Shown in Using the SQL Procedure (6/10)
- Example Code Shown in Using the SQL Procedure (7/10)
- Example Code Shown in Using the SQL Procedure (8/10)
- Example Code Shown in Using the SQL Procedure (9/10)
- Example Code Shown in Using the SQL Procedure (10/10)
- Data Sets for Examples in SQL Procedure Reference
- Recommended Reading
- Glossary
- Index (1/3)
- Index (2/3)
- Index (3/3)
Product information
- Title: SAS 9.4 SQL Procedure User's Guide, Fourth Edition, 4th Edition
- Author(s):
- Release date: January 2017
- Publisher(s): SAS Institute
- ISBN: 9781629608167
You might also like
book
SAS 9.4 SQL Procedure User's Guide, Third Edition, 3rd Edition
Describes the basics of using the SQL procedure and provides comprehensive reference information. The usage information …
book
SAS 9.4 SQL Procedure User's Guide, Second Edition, 2nd Edition
Describes the basics of using the SQL procedure and provides comprehensive reference information. The usage information …
book
Base SAS 9.4 Procedures Guide, Fifth Edition, 5th Edition
Contains the complete reference for all Base SAS procedures. Provides information about what each procedure does …
book
The SAS Programmer's PROC REPORT Handbook
Generate reports with style! The SAS Programmer's PROC REPORT Handbook: ODS Companion explains how to use …