Example: air traffic controller

SAS 9.3 Macro Language Reference

SAS Macro LanguageReferenceSAS DocumentationThe correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2011. SAS Macro Language : Reference . Cary, NC: SASI nstitute Macro Language : ReferenceCopyright 2011, SAS Institute Inc., Cary, NC, USAISBN 978-1-60764-894-9 All rights reserved. Produced in the United States of 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 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 scanning, u

What's New in the SAS 9.3 Macro Language Facility Overview The Macro Language Facility has the following enhancements: • new automatic macro variables that enable you to reduce the amount of text that is

Tags:

  Macro

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of SAS 9.3 Macro Language Reference

1 SAS Macro LanguageReferenceSAS DocumentationThe correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2011. SAS Macro Language : Reference . Cary, NC: SASI nstitute Macro Language : ReferenceCopyright 2011, SAS Institute Inc., Cary, NC, USAISBN 978-1-60764-894-9 All rights reserved. Produced in the United States of 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 a Web download or e-book.

2 Your use of this publication shall be governed by the terms established by the vendor at the time you acquire scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal andpunishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrightedmaterials. Your support of others' rights is Government Restricted Rights Notice: Use, duplication, or disclosure of this software and related documentation by the government issubject to the Agreement with SAS Institute and the restrictions set forth in FAR 19 Commercial Computer Software-Restricted Rights(June 1987).

3 SAS Institute Inc., SAS Campus Drive, Cary, North Carolina electronic book, July 20111st printing, July 2011 SAS Publishing provides a complete selection of books and electronic products to help customers use SAS software to its fullest potential. Formore information about our e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site or call and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and othercountries.

4 Indicates USA brand and product names are registered trademarks or trademarks of their respective This Book .. viiWhat's New in the SAS Macro Language Facility .. ixRecommended Reading .. xiPART 1 Understanding and Using the Macro Facility1 Chapter 1 Introduction to the Macro Facility .. 3 Getting Started with the Macro Facility .. 3 Replacing Text Strings Using Macro Variables .. 4 Generating SAS Code Using Macros .. 5 More Advanced Macro Techniques .. 9 Other Features of the Macro Language .. 10 Chapter 2 SAS Programs and Macro Processing.

5 11 SAS Programs and Macro Processing .. 11 How SAS Processes Statements without Macro Activity .. 12 How SAS Processes Statements with Macro Activity .. 14 Chapter 3 Macro Variables .. 19 Macro Variables .. 19 Macro Variables Defined by the Macro Processor .. 20 Macro Variables Defined by Users .. 23 Using Macro Variables .. 27 Displaying Macro Variable Values .. 29 Referencing Macro Variables Indirectly .. 30 Manipulating Macro Variable Values with Macro Functions .. 32 Chapter 4 Macro Processing .. 33 Macro Processing.

6 33 Defining and Calling Macros .. 33 How the Macro Processor Compiles a Macro Definition .. 34 How the Macro Processor Executes a Compiled Macro .. 36 Summary of Macro Processing .. 41 Chapter 5 Scopes of Macro Variables .. 43 Scopes of Macro Variables .. 43 Global Macro Variables .. 44 Local Macro Variables .. 46 Writing the Contents of Symbol Tables to the SAS Log .. 48 How Macro Variables Are Assigned and Resolved .. 49 Examples of Macro Variable Scopes .. 52 Special Cases of Scope with the CALL SYMPUT Routine.

7 63 Chapter 6 Macro Expressions .. 71 Macro Expressions .. 71 Defining Arithmetic and Logical Expressions .. 72 How the Macro Processor Evaluates Arithmetic Expressions .. 74 How the Macro Processor Evaluates Logical Expressions .. 76 Chapter 7 Macro Quoting .. 79 Macro Quoting .. 80 Deciding When to Use a Macro Quoting Function and Which Function to Use .. 83%STR and %NRSTR Functions .. 85%BQUOTE and %NRBQUOTE Functions .. 89 Referring to Already Quoted Variables .. 90 Deciding How Much Text to Mask with a Macro Quoting Function.

8 91%SUPERQ Function .. 91 Summary of Macro Quoting Functions and the Characters that They Mask .. 94 Unquoting Text .. 95 How Macro Quoting Works .. 97 Other Functions That Perform Macro Quoting .. 98 Chapter 8 Interfaces with the Macro Facility .. 101 Interfaces with the Macro Facility .. 101 DATA Step Interfaces .. 102 Using SAS Language Functions in the DATA Step and Macro Facility .. 105 Interfaces with the SQL Procedure .. 106 Interfaces with the SAS Component Language .. 107 SAS/CONNECT Interfaces.

9 110 Chapter 9 Storing and Reusing Macros .. 113 Storing and Reusing Macros .. 113 Saving Macros in an Autocall Library .. 114 Saving Macros Using the Stored Compiled Macro Facility .. 117 Chapter 10 Macro Facility Error Messages and Debugging .. 119 General Macro Debugging Information .. 120 Troubleshooting Your Macros .. 121 Debugging Techniques .. 134 Chapter 11 Writing Efficient and Portable Macros .. 141 Writing Efficient and Portable Macros .. 141 Keeping Efficiency in Perspective .. 142 Writing Efficient Macros.

10 142 Writing Portable Macros .. 148 Chapter 12 Macro Language Elements .. 155 Macro Language Elements .. 155 Macro Statements .. 156 Macro Functions .. 158 Automatic Macro Variables .. 164 Interfaces with the Macro Facility .. 167 Selected Autocall Macros Provided with SAS Software .. 168 Selected System Options Used in the Macro Facility .. 170 PART 2 Macro Language Dictionary173 Chapter 13 AutoCall Macros .. 175 AutoCall Macros .. 175 Dictionary .. 175ivContentsChapter 14 Automatic Macro Variables.


Related search queries