Help using Base SAS procedures

Combining Two different SAS Reports into excel in different tabs

Reply
N/A
Posts: 1

Combining Two different SAS Reports into excel in different tabs

Dear All,

I have a question related to proc report. I have a business case as below.

1) I have a report called sales which outputs to excel using tagsets

    

     it contains three tabs

          sales by country-tab1,

          sales by region-tab2,

          overall sales-tab3

The above output is generated based out of one SAS program.

2) I have a report called Growth/Decline Sales which outputs to excel using tagsets

     -it contains two tabs

     sales Growth/Decline country-tab1,

     sales Growth/Decline by region-tab2,

     Growth/Decline overall sales-tab3

The above output is generated based out of one SAS program.

Question:I want to combine these two different SAS reports and the resultant report should contain 6 excel tabs in a single excel(3 from program1 and 3 from program2).

Kindly advice.If someone could explain with example that would be really great.

Thanks all for your wonderful help in Advance.

Wish you all a very very happy new year.

SreekanthSmiley Happy

Super User
Super User
Posts: 7,392

Re: Combining Two different SAS Reports into excel in different tabs

Output from ODS continues through a program until it is closed.  Hence if you put:

ods tagsets.excelxp file=...;

Near the top of your program, and then do your reports outputting to a new tab each report.  Then right at the end ods tagsets.excelxp close; it will all go out to the same file.  So you will end up with one file with 6 tabs output.

Super User
Posts: 17,784

Re: Combining Two different SAS Reports into excel in different tabs

Basically make your two programs one. You can use %include if needed, as long as you remove ODS TAGSETS FILE commands from each one.

E.G.

ODS TAGSETS.EXCELXP File="  "  options(.....) style=journal;

*first program;

%include 'my_report1.sas';

*second program;

%include 'my_report2.sas';

ODS TAGSETS.EXCELXP close;

Ask a Question
Discussion stats
  • 2 replies
  • 226 views
  • 0 likes
  • 3 in conversation