I have a list of variables that need to be run in a SAS macro.
%let var=
A10Y
B2D
C112D
D
ER
RT
DDS
AQWE
DA
And I have a macro like this:
%macro st(inputx);
proc means data = suy;
var &inputx.;
run;
%mend;
I want to write a loop because if the number of variables are bigger than 100, I don't want to specify them one by one.
OK. I wouldn't use macro, I'd use call execute.
Create a dataset to hold all your variable lists or whatever then do the following:
*Create list of variables;
proc sql;
create table var_list as
select name
from sashelp.vcolumn
where libname='SASHELP'
and memname='CLASS'
and type='num';
run;
*Create macro;
%macro st(inputx);
proc means data = sashelp.class;
var &inputx.;
run;
%mend;
*Call macro using call execute;
data _null_;
set var_list;
call execute ("%st("||name||");");
run;