Browse Prior Art Database

SAS® 9.1 SQL Procedure User's Guide

IP.com Disclosure Number: IPCOM000243418D
Original Publication Date: 2004-Dec-31
Included in the Prior Art Database: 2015-Sep-20
Document File: 176 page(s) / 1M

Publishing Venue

SAS Institute Inc.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 4% of the total text.

Page 01 of 176

SAS® 9.1 SQL Procedure

User's Guide



Page 02 of 176

The correct bibliographic citation for this manual is as follows: SAS Institute Inc., 2004. SAS ® 9.1 SQL Procedure User's Guide. Cary, NC: SAS Institute Inc.

SAS® 9.1 SQL Procedure User's Guide

Copyright © 2004, SAS Institute Inc., Cary, NC, USA.

ISBN 1-59047-334-5
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.227-19 Commercial Computer Software-Restricted Rights (June 1987).

SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.
1st printing, January 2004
SAS Publishing provides a complete selection of books and electronic products to help customers use SAS software to its fullest potential. For more information about our e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site at support.sas.com/publishing or call 1-800-727-3228.

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. ® indicates USA registration.

Other brand and product names are registered trademarks or trademarks of their respective companies.


Page 03 of 176


4 Introduction to the SQL Procedure 1

What Is SQL? 1


What Is the SQL Procedure? 1
Terminology 2
Comparing PROC SQL with the SAS DATA Step 3 Notes about the Example Tables 4

Chapter 2

      4 Retrieving Data from a Single Table 11 Overview of the SELECT Statement 12

Selecting Columns in a Table 14

Creating New Columns 18

Sorting Data 25

Retrieving Rows That Satisfy a Condition 30

Summarizing Data 39

Grouping Data 45

Filtering Grouped Data 50

Validating a Query 52

Chapter 3

      4 Retrieving Data from Multiple Tables 55 Introduction 56

Selecting Data from More Than One Table by Using Joins 56

Using Subqueries to Select Data 74

When to Use Joins and Subqueries 80

Combining Queries with Set Operators 81

Chapter 4

      4 Creating and Updating Tables and Views 89 Introduction 90

Creating Tables 90

Inserting Rows into Tables 93

Updating Data Values in a Table 96

Deleting Rows 98

Altering Columns 99

Creating an Index 102

Deleting a Table 103

Using SQL Procedure Tables in SAS Software 103

Creating and Using Integrity Constraints in a Table 103

Creating and Using PROC SQL Views 105

Chapter 5

      4 Programming with the SQL Procedure 111 Introduction 111

Using PROC SQL Options to Create and Debug Queries 112

Improving Query Performance 115

Contents

Chapter 1



Page 04 of 176

Accessing SAS System Information Using DICTIONARY Tables 117

Using PROC SQL with the...