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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.