data dsets;
input datasets$ 40.;
datalines;
sashelp.class
sashelp.cars
sashelp.shoes
;
run
%macro print(dname=);
proc print data=&dname;
run;
%mend;
%print(dname=dsets);
Consider using CALL EXECUTE:
data dsets;
input datasets$ 40.;
datalines;
sashelp.class
sashelp.cars
sashelp.shoes
run;
data _null_;
set dsets;
call execute(cats('proc print data=',datasets,';run;'));
run;
Consider a change of strategy. Printing all data sets is usually unnecessary and produces so much output that you can't possibly look at it all. You can view (not print) as needed, any data sets you have in your SAS application, a superior approach in my opinion.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.