01-29-2018 04:32 PM
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.
01-29-2018 04:54 PM - edited 01-29-2018 04:54 PM
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
01-29-2018 05:01 PM
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
@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.