• Contents
  • About
  • What’s New in the SAS 9.3 SQL Procedure
  • About This Book
  • Using the SQL Procedure
    • 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
  • SQL Procedure Reference
    • SQL Procedure
      • Syntax: SQL Procedure
      • 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
      • UPDATE Statement
      • VALIDATE Statement
      • Overview
      • Examples: SQL Procedure
        • Example 1: Creating a Table and Inserting Data into It
        • Example 2: Creating a Table from a Query's Result
        • Example 3: Updating Data in a PROC SQL Table
        • Example 4: Joining Two Tables
        • Example 5: Combining Two Tables
        • Example 6: Reporting from DICTIONARY Tables
        • Example 7: Performing an Outer Join
        • Example 8: Creating a View from a Query's Result
        • Example 9: Joining Three Tables
        • Example 10: Querying an In-Line View
        • Example 11: Retrieving Values with the SOUNDS-LIKE Operator
        • Example 12: Joining Two Tables and Calculating a New Value
        • Example 13: Producing All the Possible Combinations of the Values in a Column
        • Example 14: Matching Case Rows and Control Rows
        • Example 15: Counting Missing Values with a SAS Macro
    • SQL SELECT Statement Clauses
      • SELECT Clause
      • INTO Clause
      • FROM Clause
      • WHERE Clause
      • GROUP BY Clause
      • HAVING Clause
      • ORDER BY Clause
    • SQL Procedure Components
      • Overview
      • 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
  • Appendixes
    • SQL Macro Variables and System Options
      • SQLCONSTDATETIME System Option
      • SQLGENERATION= System Option
      • SQLMAPPUTTO= System Option
      • SQLREDUCEPUT= System Option
      • SQLREDUCEPUTOBS= System Option
      • SQLREDUCEPUTVALUES= System Option
      • SQLREMERGE System Option
      • SQLUNDOPOLICY= System Option
      • SYS_SQLSETLIMIT Macro Variable
    • PROC SQL and the ANSI Standard
    • Source for SQL Examples
      • Overview
      • EMPLOYEES
      • HOUSES
      • MATCH_11
      • PROCLIB.DELAY
      • PROCLIB.HOUSES
      • PROCLIB.MARCH
      • PROCLIB.PAYLIST2
      • PROCLIB.PAYROLL
      • PROCLIB.PAYROLL2
      • PROCLIB.SCHEDULE2
      • PROCLIB.STAFF
      • PROCLIB.STAFF2
      • PROCLIB.SUPERV2
      • STORES
      • SURVEY
  • Recommended Reading
  • Glossary


ProductRelease
Base SAS9.3_M2
Type
Usage and Reference
Copyright Date
July 2011
Last Updated
31May2017