O'Reilly logo

SAS Certification Prep Guide, 4th Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Referencing Macro Variables Indirectly

Introduction

In the last example, you saw how to use the SYMPUT routine to create a series of macro variables whose names are based on the values of Course_code. However, you still needed to modify the TITLE statement in each PROC PRINT step in order to print output for each course.
Suppose you want to write a PROC PRINT step that you can reuse without any modification to print information about each course. You can do this by using an indirect reference in the TITLE statement.
data _null_; set sasuser.courses; call symput(course_code,trim(course_title)); run; %let crsid=C002; proc print data=sasuser.schedule noobs label; where course_code="&crsid"; var location begin_date teacher; title1 "Schedule for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required