kdp
no, you can develop your solution using sql, unless of course, you are changing the definition of the problem!
if the version of your macro that you posted earlier is what you expect to use, only the way you use it would need to change.
Your macro places values into 3 macro variables
DRV_CNT, DRVS and DRVS_NAME
These you use to specify the size of an array, provide the element names for the array, and provide a list of quoted names.
So I see no need for these macro variable names to vary.
define a parametrer for your macro
%macro iLikeThisMacro( forecast_input_data_set ) ;
To use your macro within a call-execute context [pre]
%let DRV_CNT = ;
%let DRVS = ;
%let DRVS_NAME = ;
data _null_ ;
set filelist ; * providing the name of forecast dataset in var DSN;
putlog 'invoke for ' dsn= ;
call execute( '%nrstr(%%iLikeThisMacro)' ); * deferring execution until after;
call execute( '(' !! dsn !! ')' ) ;
run ;[/pre]You might want to protect for the condition where your macro extracts no names so DRV_CNT becomes zero.
Many times I have used sql to fill macro variables with lists of values, while running in a macro, so I can assure you that it can be made to work.
Scott
destroying any pre-existing value in the macro variable seemed important to do, in this situation where the process needs to place a value into these macro variables, and avoid inheriting any previous iterations' values.
PeterC