BookmarkSubscribeRSS Feed
datj
Calcite | Level 5

Hi.

 

I am unable to export a title and a footnote along with a table to excel using proc report. However, it does print the titles and footnotes along with the tables in the result section. What do I do wrong? Moreover, is it somehow possible to use different sheet names? (I am using SAS Enterprise Guide 7.1.) I really hope someone can help me 🙂   

 

Kind Regards

 

 


%if %sysfunc(exist(table_1.)) %then
%do;


ods excel file="\\where_the_excel_output_goes" options(absolute_column_width='30' sheet_interval='PROC' sheet_name='sheetname')

style=pearl;


title1 "Title1";
footnote "Footnote1";
proc report data=table_1 nowd;


run;

%end;


%if %sysfunc(exist(table_2)) %then
%do;

 

title1 "Title2";
footnote "Footnote2";

proc report data=table_2 nowd;

 

run;

%end;

 

ods excel close;

 

3 REPLIES 3
Kurt_Bremser
Super User

For your second question, try setting sheet_interval='none' in the initial ods statement, and then use separate ods excel options(sheetname="....") statements before the respective reports.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

This is a "feature" of Excel.  Titles and Footnotes are not shown in the default view of Excel.  If you set the screen to print preview view - lower right of the Excel screen - small icons, you will then see titles/footnotes.

Do note also that your logic is incorrect.  The file is only created if the first file exists, you want to move the ods statement before the first %if check block.

Reeza
Super User

Check if your title and footnote are in your header/footnote section of Excel. 

 

Also check the embedded_title/footnote option which will move them to your main sheet. 

 

What version of Excel are you using? You can check this with he following which puts the version to your log. Note that ODS Excel is pre-production until this latest release (9.4TS1M3) or M2? 

 

 

%put &syslver;

 

Best resource so far:

http://support.sas.com/resources/papers/proceedings16/SAS5642-2016.pdf

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2600 views
  • 0 likes
  • 4 in conversation