Hi all, I am new to SAS and I am trying to work on macros. I want to know if I can create a single excel file with multiple tabs using tables created by a macro which is calle dn number of times. /*start of macro */ %macro exampeMacro(vendor, environment) proc sql; create table work.&vendor._&environment_enrl ( select distinct abc, def, ghi from database.tableName where xyz = something ); quit; proc export data = work.&vendor._&environment_enrl outfile = "location/nameOfFile.txt replace label dbms= dlm ; delimiter= '|'; run; %mend exampeMacro; /* end of macro */ %exampeMacro(vendor1, prod); %exampeMacro(vendor1, test); %exampeMacro(vendor2, prod); %exampeMacro(vendor2, test); This is just an example simple code I wrote just now in 2 minutes. Now I know if I have the file creration within the macro, it will create 4 different files. I want only 2 files, one for each vendor with 2 tabs, one for prod and one for test. Macro is called multiple times and it creates multiple tables but I want to output only 1 file for each vendor. Please help me and let me know if this is possible. Many Thanks, mraza12.
... View more