SAS 9.1.3 Language Reference: Concepts, Third Edition

Total Page:16

File Type:pdf, Size:1020Kb

SAS 9.1.3 Language Reference: Concepts, Third Edition SAS® 9.1.3 Language Reference: Concepts Third Edition The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2005. SAS ® 9.1.3 Language Reference: Concepts, Third Edition. Cary, NC: SAS Institute Inc. SAS® 9.1.3 Language Reference: Concepts, Third Edition Copyright © 2005, SAS Institute Inc., Cary, NC, USA ISBN 1-59047-905-X (e-book) ISBN-13: 978-1-59047-849-0 ISBN-10: 1-59047-840-1 (hard-copy book) All rights reserved. Produced in the United States of America. For a hard-copy book: 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. For a Web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. 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, November 2005 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/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. Other brand and product names are registered trademarks or trademarks of their respective companies. Contents PART1 SAS System Concepts 1 Chapter 1 R Essential Concepts of Base SAS Software 3 What Is SAS? 3 Overview of Base SAS Software 4 Components of the SAS Language 4 Ways to Run Your SAS Session 7 Customizing Your SAS Session 9 Conceptual Information about Base SAS Software 10 Chapter 2 R SAS Processing 11 Definition of SAS Processing 11 Types of Input to a SAS Program 12 The DATA Step 13 The PROC Step 14 Chapter 3 R Rules for Words and Names in the SAS Language 15 Words in the SAS Language 15 Names in the SAS Language 18 Chapter 4 R SAS Language Elements 23 What Are the SAS Language Elements? 25 Data Set Options 25 Formats and Informats 27 Functions and CALL Routines 38 ARM Macros 55 Statements 69 SAS System Options 71 Chapter 5 R SAS Variables 77 Definition of SAS Variables 78 SAS Variable Attributes 78 Ways to Create Variables 80 Variable Type Conversions 84 Aligning Variable Values 85 Automatic Variables 85 SAS Variable Lists 86 Dropping, Keeping, and Renaming Variables 88 Numeric Precision in SAS Software 90 Chapter 6 R Missing Values 101 Definition of Missing Values 101 iv Special Missing Values 102 Order of Missing Values 103 When Variable Values Are Automatically Set to Missing by SAS 104 When Missing Values Are Generated by SAS 105 Working with Missing Values 107 Chapter 7 R Expressions 109 Definitions for SAS Expressions 110 Examples of SAS Expressions 110 SAS Constants in Expressions 110 SAS Variables in Expressions 116 SAS Functions in Expressions 117 SAS Operators in Expressions 117 Chapter 8 R Dates, Times, and Intervals 127 About SAS Date, Time, and Datetime Values 127 About Date and Time Intervals 137 Chapter 9 R Error Processing and Debugging 147 Types of Errors in SAS 147 Error Processing in SAS 156 Debugging Logic Errors in the DATA Step 159 Chapter 10 R SAS Output 161 Definitions for SAS Output 162 Routing SAS Output 163 The SAS Log 163 Traditional SAS Listing Output 167 Changing the Destination of the Log and the Output 170 Output Delivery System 170 Chapter 11 R BY-Group Processing in SAS Programs 193 Definition of BY-Group Processing 193 References for BY-Group Processing 193 Chapter 12 R WHERE-Expression Processing 195 Definition of WHERE-Expression Processing 195 Where to Use a WHERE Expression 196 Syntax of WHERE Expression 197 Combining Expressions by Using Logical Operators 205 Constructing Efficient WHERE Expressions 206 Processing a Segment of Data That Is Conditionally Selected 206 Deciding Whether to Use a WHERE Expression or a Subsetting IF Statement 208 Chapter 13 R Optimizing System Performance 211 Definitions for Optimizing System Performance 211 Collecting and Interpreting Performance Statistics 212 v Techniques for Optimizing I/O 213 Techniques for Optimizing Memory Usage 218 Techniques for Optimizing CPU Performance 218 Calculating Data Set Size 219 Chapter 14 R Support for Parallel Processing 221 Definition of Parallel Processing 221 Threaded I/O 221 Threaded Application Processing 222 Chapter 15 R Monitoring Performance Using Application Response Measurement (ARM) 223 Introduction to ARM 223 How Does ARM Work? 225 Will ARM Affect an Application’s Performance? 225 Using the ARM Interface 226 Examples of Gathering Performance Data 229 Chapter 16 R The SAS Registry 233 Introduction to the SAS Registry 234 Managing the SAS Registry 236 Configuring Your Registry 244 Chapter 17 R Printing with SAS 247 Introduction to Universal Printing 248 Managing Printing Tasks with the Universal Printing User Interface 250 Configuring Universal Printing with Programming Statements 269 Forms Printing 275 PART2 Windowing Environment Concepts 277 Chapter 18 R Introduction to the SAS Windowing Environment 279 Basic Features of the SAS Windowing Environment 279 Main Windows of the SAS Windowing Environment 284 Chapter 19 R Managing Your Data in the SAS Windowing Environment 301 Introduction to Managing Your Data in the SAS Windowing Environment 301 Copying and Viewing Files in a Data Library 301 Using the Workspace to Manipulate Data in a Data Set 306 Importing and Exporting Data 314 PART3 DATA Step Concepts 319 Chapter 20 R DATA Step Processing 321 Why Use a DATA Step? 322 Overview of DATA Step Processing 322 Processing a DATA Step: A Walkthrough 325 vi About DATA Step Execution 330 About Creating a SAS Data Set with a DATA Step 335 Writing a Report with a DATA Step 339 The DATA Step and ODS 347 Chapter 21 R Reading Raw Data 349 Definition of Reading Raw Data 349 Ways to Read Raw Data 350 Kinds of Data 351 Sources of Raw Data 354 Reading Raw Data with the INPUT Statement 355 How SAS Handles Invalid Data 360 Reading Missing Values in Raw Data 360 Reading Binary Data 362 Reading Column-Binary Data 364 Chapter 22 R BY-Group Processing in the DATA Step 367 Definitions for BY-Group Processing 367 Syntax for BY-Group Processing 368 Understanding BY Groups 369 Invoking BY-Group Processing 370 Determining Whether the Data Requires Preprocessing for BY-Group Processing 370 Preprocessing Input Data for BY-Group Processing 371 How the DATA Step Identifies BY Groups 372 Processing BY-Groups in the DATA Step 374 Chapter 23 R Reading, Combining, and Modifying SAS Data Sets 379 Definitions for Reading, Combining, and Modifying SAS Data Sets 381 Overview of Tools 381 Reading SAS Data Sets 382 Combining SAS Data Sets: Basic Concepts 383 Combining SAS Data Sets: Methods 394 Error Checking When Using Indexes to Randomly Access or Update Data 420 Chapter 24 R Using DATA Step Component Objects 429 Introduction 429 Using the Hash Object 430 Using the Hash Iterator Object 437 Chapter 25 R Array Processing 441 Definitions for Array Processing 441 A Conceptual View of Arrays 442 Syntax for Defining and Referencing an Array 444 Processing Simple Arrays 444 Variations on Basic Array Processing 448 Multidimensional Arrays: Creating and Processing 449 Specifying Array Bounds 451 vii Examples of Array Processing 453 PART4 SAS Files Concepts 459 Chapter 26 R SAS Data Libraries 461 Definition of a SAS Data Library 461 Library Engines 463 Library Names 463 Accessing Remote SAS Libraries on SAS/CONNECT, SAS/SHARE, and WebDAV Servers 465 Library Concatenation 466 Permanent and Temporary Libraries 468 SAS System Libraries 469 Sequential Data Libraries 472 Tools for Managing Libraries 472 Chapter 27 R SAS Data Sets 475 Definition of a SAS Data Set 475 Descriptor Information for a SAS Data Set 475 Data Set Names 476 Special SAS Data Sets 478 Sorted Data Sets 479 Tools for Managing Data Sets 479 Viewing and Editing SAS Data Sets 480 Chapter 28 R SAS Data Files 481 Definition of a SAS Data File 483 Differences between Data Files and Data Views 483 Understanding an Audit Trail 485 Understanding Generation Data Sets 493 Understanding Integrity Constraints 499 Understanding SAS Indexes 512 Compressing Data Files 532 Chapter 29 R SAS Data Views 535 Definition of SAS Data Views 535 Benefits of Using SAS Data Views 536 When to Use SAS Data Views 537 DATA Step Views 537 PROC SQL Views 541 Comparing DATA Step and PROC SQL Views 542 SAS/ACCESS Views 542 Chapter 30 R Stored Compiled DATA Step Programs 545 Definition of a Stored Compiled DATA Step Program 545 Uses for Stored Compiled DATA Step Programs 545 viii Restrictions and Requirements for Stored Compiled DATA Step Programs 546 How SAS Processes Stored Compiled DATA Step Programs 546 Creating a Stored Compiled DATA Step Program 547 Executing a Stored Compiled DATA Step Program 549 Differences between Stored Compiled DATA Step Programs and DATA Step Views 552 Examples of DATA Step Programs 553 Chapter 31 R DICTIONARY Tables 555 Definition of a DICTIONARY Table 555 How to View DICTIONARY Tables 555 Chapter 32 R SAS Catalogs 559 Definition of a SAS
Recommended publications
  • The Little SAS® Book a Primer THIRD EDITION
    The Little SAS® Book a primer THIRD EDITION Lora D. Delwiche and Susan J. Slaughter The correct bibliographic citation for this manual is as follows: Delwiche, Lora D. and Slaughter, Susan J., 2003. The Little SAS Book: A Primer, Third Edition. Cary, NC: SAS Institute Inc. The Little SAS Book: A Primer, Third Edition Copyright © 2003, SAS Institute Inc., Cary, NC, USA ISBN 1-59047-333-7 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, November 2003 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/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. Other brand and product names are trademarks of their respective companies.
    [Show full text]
  • SAS 9.4 Language Reference: Concepts, Sixth Edition
    SAS® 9.4 Language Reference: Concepts, Sixth Edition SAS® Documentation November 4, 2019 The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. SAS® 9.4 Language Reference: Concepts, Sixth Edition. Cary, NC: SAS Institute Inc. SAS® 9.4 Language Reference: Concepts, Sixth Edition Copyright © 2016, SAS Institute Inc., Cary, NC, USA ISBN 978-1-62960-821-1 (Paperback) ISBN 978-1-62960-822-8 (PDF) All Rights Reserved. Produced in the United States of America. For a hard copy book: 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. For a web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials. Your support of others' rights is appreciated. U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer software developed at private expense and is provided with RESTRICTED RIGHTS to the United States Government. Use, duplication, or disclosure of the Software by the United States Government is subject to the license terms of this Agreement pursuant to, as applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR 227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S.
    [Show full text]
  • SAS® Workshop
    SAS® Workshop Manitoba Centre for Health Policy University of Manitoba Input and Development by: Charles Burchill, Heather Prior, Wendy Au, Jen Bodnarchuk, Randy Walld Shelley Derksen, Jill MacGregor, Ruth-Ann Soodeen, and Ruth Bond September 2018 - 1 - - 2 - Table of Contents Outline ..................................................................................................................................................................................................... 5 Resource Books ................................................................................................................................................................................. 6 CD Content ........................................................................................................................................................................................ 6 SAS University Edition ..................................................................................................................................................................... 6 Full Version of SAS (UofM Students and Staff only)........................................................................................................................ 6 Data Use Agreement................................................................................................................................................................................ 8 Overview ................................................................................................................................................................................................
    [Show full text]
  • Multilingual Computing with SAS® 9.4
    Multilingual Computing with SAS ® 9.4 Technical Paper Multilingual Computing with SAS® 9.4 Content provider for Multilingual Computing with SAS® 9.4 was Manfred Kiefer, Principal Domain Specialist in the Software Globalization Division. Multilingual Computing with SAS ® 9.4 Table of Contents Introduction .................................................................................................................... 1 Installing and Configuring the SAS System ................................................................ 1 New TrueType fonts ....................................................................................................... 3 Language of Metadata ................................................................................................... 4 Change the locale of a deployment .............................................................................. 4 Working with Multi-byte Data ........................................................................................ 4 Reading and Writing Data ............................................................................................. 5 External Files ............................................................................................................. 5 SAS Libraries ............................................................................................................. 5 (R)DBMS Tables ........................................................................................................ 8 Language Switching ...................................................................................................
    [Show full text]
  • SAS 9.4 Companion for UNIX Environments
    SAS® 9.4 Companion for UNIX Environments SAS® Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2013. SAS® 9.4 Companion for UNIX Environments. Cary, NC: SAS Institute Inc. SAS® 9.4 Companion for UNIX Environments Copyright © 2013, SAS Institute Inc., Cary, NC, USA All rights reserved. Produced in the United States of America. For a hardcopy book: 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. For a Web download or e-book:Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials. Your support of others' rights is appreciated. 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. Printing 1, June 2013 Electronic book 1, June 2013 SAS® Publishing provides a complete selection of books and electronic products to help customers use SAS software to its fullest potential.
    [Show full text]
  • Fundamentals of Programming in SAS: a Case Studies Approach
    The correct bibliographic citation for this manual is as follows: Blum, James and Jonathan Duggins. 2019. Fundamentals of Programming in SAS®: A Case Studies Approach. Cary, NC: SAS Institute Inc. Fundamentals of Programming in SAS®: A Case Studies Approach Copyright © 2019, SAS Institute Inc., Cary, NC, USA 978-1-64295-228-5 (Hardcover) 978-1-63526-672-6 (Paperback) 978-1-63526-671-9 (Web PDF) 978-1-63526-669-6 (epub) 978-1-63526-670-2 (kindle) All Rights Reserved. Produced in the United States of America. For a hard-copy book: 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. For a web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication. The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials. Your support of others’ rights is appreciated. U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer software developed at private expense and is provided with RESTRICTED RIGHTS to the United States Government. Use, duplication, or disclosure of the Software by the United States Government is subject to the license terms of this Agreement pursuant to, as applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR 227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S.
    [Show full text]
  • (TS2M0) of the SAS System Under UNIX Environments
    Installation Instructions and System Administrator’s Guide for Release 8.2 (TS2M0) of the SAS® System under UNIX® Environments Table of Contents Chapter 1, Before You Install the SAS System.......................................................................................... 1 Audience..................................................................................................................................................... 1 Using This Book......................................................................................................................................... 1 Terminology ............................................................................................................................................... 2 Using Netscape Communicator.................................................................................................................. 3 Recovering From Errors............................................................................................................................. 3 Service and Support ................................................................................................................................... 3 Chapter 2, Installing the SAS System......................................................................................................... 7 SAS Setup .................................................................................................................................................. 7 Installation Overview ............................................................................................................................
    [Show full text]
  • What's New in This Version Of
    What's new Version 4.3 new features and enhancements What's New in WPS version 4.3 Version: 4.3.1 (c) 2021 World Programming www.worldprogramming.com What's new Version 4.3 new features and enhancements Contents Introduction............................................................................................... 3 Workbench................................................................................................ 4 SAS language perspective............................................................................................................. 4 Workflow perspective......................................................................................................................4 WPS Analytics.......................................................................................... 8 Core SAS language support...........................................................................................................8 System options.....................................................................................................................8 Global statements................................................................................................................ 8 DATA step............................................................................................................................8 Output Delivery System....................................................................................................... 9 General procedures.......................................................................................................................
    [Show full text]
  • SAS (Software) 1 SAS (Software)
    SAS (software) 1 SAS (software) SAS SAS 9 on Microsoft Windows Developer(s) SAS Institute Stable release 9.3 / July 12, 2011 Written in C Operating system Windows, IBM mainframe, Unix/Linux, OpenVMS Alpha Type numerical analysis License proprietary SAS (pronounced "sass", originally Statistical Analysis System) is an integrated system of software products provided by SAS Institute Inc. which enables programmers to perform: • retrieval, management, and mining • report writing and graphics • statistical analysis • business planning, forecasting, and decision support • operations research and project management • quality improvement • applications development • data warehousing (extract, transform, load) • platform independent and remote computing In addition, SAS has many business solutions that enable large-scale software solutions for areas such as IT management, human resource management, financial management, business intelligence, customer relationship management and more. Description SAS is driven by SAS programs, which define a sequence of operations to be performed on data stored as tables. Although non-programmer graphical user interfaces to SAS exist (such as the SAS Enterprise Guide), these GUIs are most often merely a front-end that automates or facilitates the generation of SAS programs. The functionalities of SAS components are intended to be accessed via application programming interfaces, in the form of statements and procedures. A SAS program has three major parts: 1. the DATA step 2. procedure steps (effectively, everything
    [Show full text]