The SAS Output Delivery System and reporting techniques

Placing Multiple Tables in Same Excel Sheet via ODS

Reply
Frequent Contributor
Posts: 96

Placing Multiple Tables in Same Excel Sheet via ODS

I need to be able to place small datasets into the SAME excel spreadsheet at specific locations within that sheet. I have tried:

 

ods listing close;
ods html close;
goptions device=actximg;
%let dat = %sysfunc(today(),yymmdd6.);

ods excel file="h:\temp.xlsx";
ods excel options(embedded_titles="no" start_at="5,5" sheet_name="Sheet1" sheet_interval="none");
 
proc print data=EGTASK.NEW_PAIRS_FINAL;
title "Expense Report Year 2016";
run;

ods excel options (embedded_titles="no" start_at="50,30" sheet_name="Sheet1");
proc print data=EGTASK.NEW_PAIRS_FINAL;
title "Expense Report Year 2016";
run;
 
ods excel close;

It will place the first table in 5,5 as asked, but it will place the second table right under it (one line separating them) instead of 50,30. We need to place these at specific cells on the same sheet. Can this be done? Not sure what to do in this case.

 

Cheers!

Super User
Posts: 23,997

Re: Placing Multiple Tables in Same Excel Sheet via ODS

You can if your tables go down (linear) but if you want side by side tables that won't fly with ODS EXCEL. 

 

Super User
Posts: 8,215

Re: Placing Multiple Tables in Same Excel Sheet via ODS

[ Edited ]

If you're using a Microsoft Window's system you can do it with the macro you can download from: http://www.sascommunity.org/wiki/A_Poor/Rich_SAS_Users_Proc_Export

 

Art, CEO, AnalystFinder.com

 

 

 

Frequent Contributor
Posts: 96

Re: Placing Multiple Tables in Same Excel Sheet via ODS

Can this be done with another method? DDE?

Also, with respect to my example above, 50,30 won't work but 5,30 would? Thx
Super User
Posts: 23,997

Re: Placing Multiple Tables in Same Excel Sheet via ODS


BCNAV wrote:
Can this be done with another method? DDE?



Yes, but DDE is a pain. The documentation for DDE has an example on how to write data out and someone else just had a DDE question and their code is mostly correct Smiley Happy

 

@art297 macro is another really good option as well. 

 

For custom reports like that, I usually do a mix. 

I create an Excel template with the data in the linear form and then link the table data over to the displayed view, so how I export the data isn't really relevant. This works with reports that have consistent structure and you have a good idea of the number of rows/tables/graphs that are needed ahead of time. 

 

 

 

 

Ask a Question
Discussion stats
  • 4 replies
  • 437 views
  • 0 likes
  • 3 in conversation