Chapter 4: The Macro Facility

Introduction

Understanding Macro Variables

Using the “Dot” in Macro Variable Names

Determining How Many &s to Use

Understanding Quotation Marks

Using Macro Quoting

Unquoting

Forcing Single Quotation Marks

Writing Macros

Using Autocall Macros

Determining When to Write a Macro

Wrapping Long Lines of Code

Using the IN Operator

Testing for Blanks

Validating Parameters

Creating Macro Functions

Introduction

I rarely write a SAS program that doesn’t contain macro variables and macros. Macros enable you to take more control over your programs: passing values from one part of the program to another, conditionally executing sections of code, running the same piece of code multiple times, and performing countless other tasks. ...

Get Practical and Efficient SAS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.