SAS® 9 Macro Language Reference
Original Publication Date: 2002-Dec-31
Included in the Prior Art Database: 2015-Sep-18
SAS Institute Inc.
Page 01 of 319
Macro Language Reference
Page 02 of 319
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2002. SAS ® 9 Macro Language: Reference. Cary, NC: SAS Institute Inc.
SAS® 9 Macro Language: Reference
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 319
P A R T 1 Understanding and Using the Macro Facility 1
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 8
Other Features of the Macro Language 9
Chapter 2 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 Macro Variables 19
Introduction to Macro Variables 19
Macro Variables Defined by SAS 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
Chapter 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 Com...