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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.