Hi All,
I have a simple proc tabulate and ODS EXCEL to export to MS Excel. The result has a sheet by every segment.
How I configure the ODS Excel statement to have a segment name as sheet name?
My current SAS code is:
ods excel file="/path/File_Test.xlsx" options(sheet_interval='page');
PROC TABULATE DATA=WORK.Test ;
CLASS Name Segment &columnas / ORDER=UNFORMATTED MISSING;
TABLE Segment, &columnas, Name*ColPctN ;
RUN;
ods excel close;
But as results each sheet is named: Tabulate 1 - Table 1, Tabulate 2 - Table 1, etc. Please see the attached file.
Regards,
Thanks @Cynthia_sas, works perfect!
Try the Sheet_Label and Sheet_name options in the ODS EXCEL statement.
You can find a lot of examples online using ODS TAGSETS which is the same approach you need for ODS EXCEL.
https://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#data
I'm getting some weird behaviour but maybe this will work for you:
proc sort data=sashelp.cars out=cars;
by origin;
run;
ods excel file="c:\_localdata\temp.xlsx" options(sheet_interval="bygroup" sheet_label='');
proc print data=cars;
by origin;
run;
ods excel close;
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.