Browse Prior Art Database

SAS Macro Language Reference Disclosure Number: IPCOM000243177D
Original Publication Date: 1999-Dec-31
Included in the Prior Art Database: 2015-Sep-17
Document File: 320 page(s) / 2M

Publishing Venue

SAS Institute Inc.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 3% of the total text.

Page 01 of 320

SAS® Macro Language: Reference, Version 8

Page 02 of 320

The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 1999. SAS ® Macro Language: Reference, Version 8. Cary, NC: SAS Institute Inc.

SAS® Macro Language: Reference, Version 8

Copyright © 1999, SAS Institute Inc., Cary, NC, USA

ISBN 1-58025-666-X (e-book)

ISBN 1-58025-522-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, October 1999
2nd printing, October 2000
3rd printing, January 2001
4th printing, October 2001
5th printing, August 2003
6th printing, May 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 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 320

4 Introduction 1

Getting Started with the Macro Facility 1

Replacing Text Strings Using Macro Variables 2 Generating SAS Code Using Macros 3
More Advanced Macro Techniques 6
Other Features of the Macro Language 7

Chapter 2

4 SAS Programs and Macro Processing 9

Introduction 9
How SAS Processes Statements without Macro Activity 10

How SAS Processes Statements with Macro Activity 12

Chapter 3

      4 Macro Variables 17 Introduction 17

Macro Variables Defined by the SAS System 18

Macro Variables Defined by Users 20

Using Macro Variables 23

Displaying Macro Variable Values 26

Referencing Macro Variables Indirectly 27

Manipulating Macro Variable Values with Macro Functions 28

Chapter 4

      4 Macro Processing 29 Introduction 29

Defining and Calling Macros 29

How the Macro Processor Compiles a Macro Definition 30

How the Macro Processor Executes a Compiled Macro 32

Summary 36

Chapter 5

      4 Scope of Macro Variables 37 Introduction 37

Global Macro Variables 38

Local Macro Variables 39