I have a macro function defined as below.
%macro sqlloop(event_id, empl_nbr_var, fleet, base, position);
...lots of code...
%mend;
this macro creates a table called export_table2
that i want to stack on top of each other for all of the times I run this code. I tried below
data executed;
set work.vars;
call execute('%sqlloop(17,'||strip(empl_nbr_var)||','||strip(fleet)||','||strip(base)||','||strip(position)||');');
run;
data summary_pilots;
set work.export_table2 summary_pilots;
run;
but this gives an error since summary_pilots doesnt exist as I'm trying to reference it. I also tried a weird work around where I took out the first row of vars
into a new table and deleted it from the old, then tried executing below code (where row1 is the first row and vars is everything except the first row).
data _null_;
set Work.row1;
call execute('%sqlloop(17,'||strip(empl_nbr_var)||','||strip(fleet)||','||strip(base)||','||strip(position)||');');
run;
data summary_pilots;
set work.export_table2;
run;
data executed;
set work.vars;
call execute('%sqlloop(17,'||strip(empl_nbr_var)||','||strip(fleet)||','||strip(base)||','||strip(position)||');');
run;
data summary_pilots;
set work.export_table2 summary_pilots;
run;
and it still doesnt function quite as I want. This only includes the first table (from row1) and the very last table generated by the macro. I can see why it does this, since call execute is running them all at once and writing over any old tables, but I still dont know how to fix it. Any attempt to put it inside the earlier data step has failed as well. any suggestions?