Search code examples
sassas-macro

Exporting multiple results to same Excel Sheet


I have this Macro A. Every time I run it, I get a result as the image below (include 2 tables and 1 graph). Note that this time I copied them from SAS output window and paste it on Excel then format it manually. My question is, when I run Macro A multiple times, how can I export all the results to a single specific Excel Sheet, one after another automatically?

Since I'm kinda a beginner in SAS, so a simple solution is preferred :)

Thanks a bunch!!

SAS result in excel


Solution

  • Use ODS Excel and sheet_interval option. This assumes SAS 9.4+

     Ods excel file='myfile.xlsx' options(sheet_interval='none') style=meadow;
    
     %macro_run();
    
     Ods excel close;
    

    Within the macro you may need to add:

    Ods excel options(sheet_interval='none');