Hi,
When creating a new worksheet using contents=yes, this new worksheet is named "The Table of Contents".
Is there a way to change this name e.g. to TOC or to "Table des matières" for example ?
I've looked into the template but couldn't find any prespecified text for the tab name.
Using locale=FR_FR does not change the worksheet name.
The same problem occurs with index='yes'.
ods excel file="&xxtest./reporting/ods_excel_test.xlsx"
options(contents='yes');
ods excel options(sheet_name='Male');
proc print data=sashelp.class noobs;
where sex='M';
run;
ods excel options(sheet_name='Female');
proc print data=sashelp.class noobs;
where sex='F';
run;
ods excel close;
An XLSX file is just a ZIP with special content.
So just change the name yourself.
Example: Change sheet name to TOC.
ods excel file="c:\downloads\toc.xlsx"
options(contents='yes' sheet_name='TOC')
;
ods excel options(sheet_name='Male');
proc print data=sashelp.class noobs;
where sex='M';
run;
ods excel options(sheet_name='Female');
proc print data=sashelp.class noobs;
where sex='F';
run;
ods excel close;
filename copy temp;
data _null_;
infile 'C:\downloads\toc.xlsx' zip member='xl/workbook.xml';
input;
file copy ;
_infile_=tranwrd(_infile_,'sheet name="The Table of Contents"','sheet name="TOC"');
put _infile_;
run;
data _null_;
infile copy;
file 'C:\downloads\toc.xlsx' zip member='xl/workbook.xml';
input;
put _infile_;
run;
An XLSX file is just a ZIP with special content.
So just change the name yourself.
Example: Change sheet name to TOC.
ods excel file="c:\downloads\toc.xlsx"
options(contents='yes' sheet_name='TOC')
;
ods excel options(sheet_name='Male');
proc print data=sashelp.class noobs;
where sex='M';
run;
ods excel options(sheet_name='Female');
proc print data=sashelp.class noobs;
where sex='F';
run;
ods excel close;
filename copy temp;
data _null_;
infile 'C:\downloads\toc.xlsx' zip member='xl/workbook.xml';
input;
file copy ;
_infile_=tranwrd(_infile_,'sheet name="The Table of Contents"','sheet name="TOC"');
put _infile_;
run;
data _null_;
infile copy;
file 'C:\downloads\toc.xlsx' zip member='xl/workbook.xml';
input;
put _infile_;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.