Cover
title | : | SAS SQL Procedure User's Guide : Version 8 |
author | : |
publisher | : | SAS Publishing |
isbn10 | asin | : | 158025599X |
print isbn13 | : | 9781580255998 |
ebook isbn13 | : | 9781580257213 |
language | : | English |
subject | SQL (Computer program language) |
publication date | : | 2000 |
lcc | : | QA76.73.S67S27 2000eb |
ddc | : | 005.75/6 |
subject | : | SQL (Computer program language) |
Page i
SAS SQL Procedure User's Guide
Version 8
Page ii
The correct bibliographic citation for this manual is as follows: SAS Institute Inc., SASSQL Procedure User's Guide, Version 8, Cary, NC: SAS Institute Inc., 2000.
SASSQL Procedure User's Guide, Version 8
Copyright 2000 by SAS Institute Inc., Cary, NC, USA.
ISBN 158025599X
All rights reserved. Produced in the United States of America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc.
U.S. Government Restricted Rights Notice. Use, duplication, or disclosure of this software and related documentation by the U.S. government is subject to the Agreement with SAS Institute and the restrictions set forth in FAR 52.22719 Commercial Computer Software-Restricted Rights (June 1987).
SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.
1st printing, April 2000
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries.
IBM and all other International Business Machines Corporation product or service names are registered trademarks or trademarks of International Business Machines Corporation in the USA and other countries. indicates USA registration.
Other brand and product names are registered trademarks or trademarks of their respective companies.
The Institute is a private company devoted to the support and further development of its software and related services.
Page iii
Contents
Chapter 1 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 | |
Chapter 2 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 | |
Chapter 3 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 | |
Chapter 4 Creating and Updating Tables and Views | |
Introduction | |
Creating Tables | |
Inserting Rows into Tables | |
Updating Data Values in a Table | |
Deleting Rows | |
Altering Columns | |
Indexing a Column | |
Deleting a Table | |
Using SQL Procedure Tables in SAS Software | |
Creating and Using Integrity Constraints in a Table | |
Creating and Using PROC SQL Views | |
Chapter 5 Programming with the SQL Procedure | |
Introduction | |
Using PROC SQL Options to Create and Debug Queries | |
Improving Query Performance | |
Page iv
Accessing SAS System Elements using Dictionary Tables | |
Using PROC SQL with the SAS Macro Facility | |
Formatting PROC SQL Output Using the REPORT Procedure | |
Accessing a DBMS with SAS/ACCESS | |
Using the Output Delivery System (ODS) with PROC SQL | |
Chapter 6 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 | |
Index | |
Page 1
CHAPTER 1
Introduction to the SQL Procedure
What Is SQL?
What Is the SQL Procedure?
Terminology
Tables
Queries
Views
Null Values
Comparing PROC SQL with the SAS DATA Step
Notes about the Example Tables
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.
Next page