Hello, I'm new to programming and I'm trying to automate a process, I'm in a part where my code creates about 160 excel files and sheets are added to these files (each excel sheet, a different code since it starts from a table in different SAS). Before it went well because the destination path of these xlsx files was within SAS, now it is still within SAS but in a bridge folder with windows, that is, the excels are created and automatically when going to the bridge folder, they go from sas and come to windows. The problem is that as the files are transferred very quickly to windows, in the following block of code where the second sheet would be created, a new excel is created for me since by the time I execute the second piece of code, the files that were generated in the first one is already in windows, and my bridge folder seen from SAS is empty, so the excel files are not renamed and files are created with loose sheets. What I had thought was to create a slightly larger code where I can create 5 sheets at a time (before there would be 5 pieces of code, 1 for each sheet) and that directly send it to my bridge folder, so that the complete excel files are exported . Does anyone know if this can be done? I pass you the code of two sheets that I create and I would like to work, the idea would be to do the same with the other pieces of code. *MACRO 1;
proc sql noprint;
select distinct
cat("DATA I1_",&month.,"_",compress(&COLUMN.,,'kad'),"; set &TABLE.(where=(&COLUMN.='", &COLUMN.,"'));run;
proc export data=I1_",&month.,"_", &COLUMN.,"
outfile='&out_path.","ST_", &column.,"_", &fecha., "_S_M7_",&month.,"'
dbms=xlsx replace;sheet='SHEET 1';run;
;run")length=500 into :allsteps separated by ';'
from &TABLE.
quit;
%macro runSteps;
&allsteps.;
%mend;
%runsteps
*MACRO 2;
proc sql noprint;
select distinct
cat("DATA I2_",&month.,"_",compress(&COLUMN.,,'kad'),"; set &TABLE.(where=(&COLUMN.='", &COLUMN.,"'));run;
proc export data=I2_",&month.,"_", &COLUMN.,"
outfile='&out_path.","S_", &column.,"_", &fecha., "_S_M7_",&month.,"'
dbms=xlsx replace;sheet='SHEET 2';run;
;run")length=500 into :allsteps separated by ';'
from &TABLE.
quit;
%macro runSteps;
&allsteps.;
%mend;
%runSteps I don't know if I have expressed myself clearly, but my intention is to create those 2 sheets in the same code, not having to make a code for one and another code for another, to be able to export the excel with all its sheets to the bridge folder, and do not export loose sheets since they are transferred very quickly to windows. Thank you very much in advance, greetings
... View more