Example: bankruptcy

SAS 9.2 Macro Language: Reference

SAS Macro Language Reference The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS Macro Language: Reference . Cary, NC: SAS Institute Inc. SAS Macro Language: Reference Copyright 2009, SAS Institute Inc., Cary, NC, USA. ISBN 978-1-59994-708-2. 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.

Contents What’s New vii Overview vii New Automatic Macro Variables vii New SAS Macro System Options viii New Options for the %MACRO Statement viii New Autocall Macros and Macro Functions for DBCS viii PART1 Understanding and Using the Macro Facility 1 Chapter 1 …

Information

Domain:

Source:

Link to this page:

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

Other abuse

Transcription of SAS 9.2 Macro Language: Reference

1 SAS Macro Language Reference The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS Macro Language: Reference . Cary, NC: SAS Institute Inc. SAS Macro Language: Reference Copyright 2009, SAS Institute Inc., Cary, NC, USA. ISBN 978-1-59994-708-2. 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.

2 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. Government Restricted Rights Notice. Use, duplication, or disclosure of this software and related documentation by the government is subject to the Agreement with SAS Institute and the restrictions set forth in FAR Commercial Computer Software-Restricted Rights (June 1987). SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513. 1st electronic book, February 2009.

3 2nd electronic book, May 2010. 1st printing, March 2009. 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 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.

4 Other brand and product names are registered trademarks or trademarks of their respective companies. Contents What's New vii Overview vii New Automatic Macro Variables vii New SAS Macro System Options viii New Options for the % Macro Statement viii New Autocall Macros and Macro Functions for DBCS viii PART 1 Understanding and Using the Macro Facility 1. Chapter 1 4 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.

5 More Advanced Macro Techniques 9. Other Features of the Macro Language 10. Chapter 2 4 SAS Programs and Macro Processing 11. Introduction to SAS Programs and Macro Processing 11. How SAS Processes Statements without Macro Activity 12. How SAS Processes Statements with Macro Activity 14. Chapter 3 4 Macro Variables 19. Introduction to Macro Variables 19. Macro Variables Defined by the Macro Processor 20. Macro Variables Defined by Users 22. Using Macro Variables 25. Displaying Macro Variable Values 28. Referencing Macro Variables Indirectly 29.

6 Manipulating Macro Variable Values with Macro Functions 30. Chapter 4 4 Macro Processing 33. Introduction to Macro Processing 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 4 Scopes of Macro Variables 43. Introduction to the Scopes of Macro Variables 43. Global Macro Variables 44. Local Macro Variables 45. Writing the Contents of Symbol Tables to the SAS Log 46. How Macro Variables Are Assigned and Resolved 47.

7 Iv Examples of Macro Variable Scopes 50. Special Cases of Scope with the CALL SYMPUT Routine 60. Chapter 6 4 Macro Expressions 69. Introduction to Macro Expressions 69. Defining Arithmetic and Logical Expressions 70. How the Macro Processor Evaluates Arithmetic Expressions 72. How the Macro Processor Evaluates Logical Expressions 74. Chapter 7 4 Macro Quoting 77. Introduction to Macro Quoting 78. Deciding When to Use a Macro Quoting Function and Which Function to Use 81. %STR and %NRSTR Functions 83. %BQUOTE and %NRBQUOTE Functions 87.

8 Referring to Already Quoted Variables 88. Deciding How Much Text to Mask with a Macro Quoting Function 88. %SUPERQ Function 89. Summary of Macro Quoting Functions and the Characters They Mask 92. Unquoting Text 93. How Macro Quoting Works 95. Other Functions That Perform Macro Quoting 96. Chapter 8 4 Interfaces with the Macro Facility 99. Introduction to Interfaces with the Macro Facility 99. DATA Step Interfaces 100. Using SAS Language Functions in the DATA Step and Macro Facility 103. Interfaces with the SQL Procedure 104.

9 Interfaces with the SAS Component Language 105. SAS/CONNECT Interfaces 108. Chapter 9 4 Storing and Reusing Macros 111. Introduction to Storing and Reusing Macros 111. Saving Macros in an Autocall Library 112. Saving Macros Using the Stored Compiled Macro Facility 114. Chapter 10 4 Macro Facility Error Messages and Debugging 117. General Macro Debugging Information 117. Troubleshooting Your Macros 119. Debugging Techniques 132. Chapter 11 4 Writing Ef cient and Portable Macros 139. Introduction to Writing Efficient and Portable Macros 139.

10 Keeping Efficiency in Perspective 139. Writing Efficient Macros 140. Writing Portable Macros 146. Chapter 12 4 Macro Language Elements 153. v Introduction to Macro Language Elements 153. Macro Statements 154. Macro Functions 155. Automatic Macro Variables 161. Interfaces with the Macro Facility 163. Selected Autocall Macros Provided with SAS Software 164. Selected System Options Used in the Macro Facility 166. PART 2 Macro Language Dictionary 169. Chapter 13 4 AutoCall Macros 171. Chapter 14 4 Automatic Macro Variables 185.


Related search queries