I use ODS EXCEL to create some text and plots. I want two tabs in my ODS EXCEL output, that part works fine. You will notice that in the code below, the exact same code is used twice, once before the ods excel options(sheet_interval='NOW'); and then after ods excel options(sheet_interval='NOW');
Remember ... exact same code generates the two tabs, but inconsistent titles on the two tabs. Why? How do I fix this?
Code:
ods excel file="test.xlsx" options(embedded_titles='YES' sheet_interval='NONE');
title "Print of SASHELP.CLASS";
proc print data=sashelp.class(obs=10);
id name;
var age sex height weight;
run;
title;
ods text="^{style [color=black width=100% textalign=l] Footnote goes here}";
proc sgplot data=sashelp.class(obs=10);
scatter x=height y=weight;
run;
ods excel options(sheet_interval='NOW');
title "Print of SASHELP.CLASS";
proc print data=sashelp.class(obs=10);
id name;
var age sex height weight;
run;
title;
ods text="^{style [color=black width=100% textalign=l] Footnote goes here}";
proc sgplot data=sashelp.class(obs=10);
scatter x=height y=weight;
run;
ods excel close;
Output on tab 1 — note that the title Print of SASHELP.CLASS appears only at the top, which is what I want.
Output on tab 2 — Note that the title appears twice, not what I want
embed_titles_once='ON' seems to fix the problem. I never used that one before. Thanks!
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.