@ErikLund_Jensen
I've never considered using a single CALL EXECUTE() for anything else than a full run-group. Learned something new 🙂
Using what you've posted with my sample data - and it works quite well.
/* create sample data */
data have;
array vv_123456789_123456789_abc_ {20000} $1 (20000*'A');
set sashelp.class;
run;
data vars_to_drop(drop=_:);
length variable $32;
do _i=1 to 9999, 10001 to 20000;
variable=cats('vv_123456789_123456789_abc_',put(_i,f5.));
output;
end;
stop;
run;
%macro extract(input_data, input_list, output_data);
data _null_;
set &input_list end=eof;
if _N_ = 1 then
call execute("data &output_data; set &input_data(drop=");
call execute(variable);
if eof then
call execute("); run;");
run;
%mend;
%extract(have, vars_to_drop, want);
... View more