SAS®9 SQL QueryWindow User's Guide
Original Publication Date: 2002-Dec-31
Included in the Prior Art Database: 2015-Sep-18
SAS Institute Inc.
Page 01 of 107
SQL Query Window User's Guide
Page 02 of 107
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2002. SAS ® 9 SQL Query Window User's Guide. Cary, NC: SAS Institute Inc.
SAS® 9 SQL Query Window User's Guide
Copyright © 2002 by SAS Institute Inc., Cary, NC, USA
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, June 2002
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 www.sas.com/pubs 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.
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.
Oracle® and all other Oracle Corporation product or service names are registered trademarks or trademarks of Oracle Corporation in the USA and other countries.
Other brand and product names are registered trademarks or trademarks of their respective companies.
Page 03 of 107
4 An Overview of the SQL Query Window 1
Invoking the SQL Query Window 2
Query Window Menus 3
4 Examples 9
Setting Up the Environment 10
Performing Simple Queries 14
Sorting Your Output 22
Building Calculated Columns 25
Building and Adding Tables 29
Joining Matching Data 30
Saving Queries 32
Using Parentheses and Other Operators 36
Designing and Saving a Report 38
Creating Summary Reports 45
Counting and Grouping Data Automatically 47
Summarizing Groups of Data 52
Subsetting Groups of Data with the HAVING Condition 56
Using the Automatic Lookup Feature 58
Creating and Using Outer Joins 66
4 Customizing Your Session and Using Advanced Features 73 Setting Your Profile 73
Switching to Another Profile 82
Handling Missing Values 82
Defining a Format Outside the SQL Query Window 83
Changing Access Modes 85
Using SAS Data Sets to Store System Tables Information 88
Handling Embedded Blanks in Column Names 89
Including Saved Queries 89