|
Here is a solution. Assume you know the prefix of a list of macro variables.
proc sql noprint;
select name into : vlist separated by ' '
from dictionary.macros
where scope='GLOBAL' and (name like 'L%' or name like 'W%')
order by 1
;
quit;
%SYMDEL &vlist;
%put _all_;
***create some macro variables***;
data _null_;
n=ceil(10*ranuni(-1));
do i=1 to n;
call symputx(catt('L',i), i);
end;
n=ceil(10*ranuni(-1));
do i=1 to n;
call symputx(catt('W',i), i);
end;
run;
***make a variable w/ prefix into a list;
proc sql noprint;
select name into : vlistL separated by ' '
from dictionary.macros
where scope='GLOBAL' and name like 'L%'
order by 1
;
quit;
%put >>>>&vlistL<<<<;
***make a variable w/ prefix into a list;
proc sql noprint;
select name into : vlistW separated by ' '
from dictionary.macros
where scope='GLOBAL' and name like 'W%'
order by 1
;
quit;
%put >>>>&vlistL<<<< >>>>&vlistW<<<<;
|