Creating Multiple Macro Variables during DATA Step Execution

Creating Multiple Macro Variables with CALL SYMPUT

Sometimes you might want to create multiple macro variables within one DATA step. For example, suppose you want to write a program that lists all of the scheduled dates for a particular course, using a macro variable to record the title of the course.
%let crsid=C005;
data _null_;
   set sasuser.courses;
   where course_code="&crsid";
   call symput('title',trim(course_title));
run;
    
proc print data=sasuser.schedule noobs label;
   where course_code="&crsid";
   var location begin_date teacher;
   title1 "Schedule for &title";
   options nodate nonumber;
run;
In this example, the value of the data set variable Course_title for the course whose Course_code ...

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.