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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.