Overview

Introduction

SAS macro variables enable you to substitute text in your SAS programs. Macro variables can supply a variety of information, including
  • operating system information
  • SAS session information
  • text strings.
When you reference a macro variable in a SAS program, SAS replaces the reference with the text value that has been assigned to that macro variable. By substituting text into programs, SAS macro variables make your programs more reusable and dynamic.
The following sample code shows how a macro variable might be used to substitute a year value throughout a program, enabling you to quickly and easily change the value of year throughout the program:
%let year=2002; proc print data=sasuser.schedule; where year(begin_date)= ...

Get SAS Certification Prep Guide, 4th Edition 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.