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 ...
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.