SAS 9.2 Macro Language Reference
Original Publication Date: 2009-Dec-31
Included in the Prior Art Database: 2015-Sep-18
SAS Institute Inc.
Page 01 of 384
SAS® 9.2 Macro Language
Page 02 of 384
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS ® 9.2 Macro Language: Reference. Cary, NC: SAS Institute Inc.
SAS® 9.2 Macro Language: Reference
Copyright © 2009, SAS Institute Inc., Cary, NC, USA
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 electronic book, February 2009
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 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 384
P A R T 1 Understanding and Using the Macro Facility 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
More Advanced Macro Techniques 9
Other Features of the Macro Language 10
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
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
Manipulating Macro Variable Values with Macro Functions 30
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
4 Scopes of Macro Variables 43