Hello,
Is there a way to output two tabs with two different names and two different table titles in Excel format? I could my output by assigning one tab with "NESS_Pos
" and the other one was automatically changed to "NESS_Pos2" How can I assign to a specific name in the second table and tab? Thanks.
ods excel file="Test_&tdate..xlsx";
ods excel options(sheet_name="NESS_Pos");
title "new NESS tests with positive results only";
proc freq data=test;
table updated_timestamp;
table epi_message*erv_rslt / list missing;
run;
title;
ods excel close;
Use two separate PROC steps.
ods excel file="%sysfunc(pathname(work))/sheetnames.xlsx";
ods excel options (sheet_name='SEX');
proc freq data=sashelp.class;
tables sex;
run;
ods excel options (sheet_name='AGE');
proc freq data=sashelp.class;
tables age;
run;
ods excel close;
title "new NESS tests with positive results only";
proc freq data=test;
table updated_timestamp;
table epi_message*erv_rslt / output = test2 list missing;
run;
title;
PROC EXPORT DATA= test2 /*Sheet 1*/
outfile= "Test_&tdate..xlsx "
dbms=xlsx replace;
sheet="NESS_Pos";
run;
PROC EXPORT DATA= test2 /*Sheet 2*/
outfile= "Test_&tdate..xlsx "
dbms=xlsx replace;
sheet="NESS_Pos2";
run;
Use two separate PROC steps.
ods excel file="%sysfunc(pathname(work))/sheetnames.xlsx";
ods excel options (sheet_name='SEX');
proc freq data=sashelp.class;
tables sex;
run;
ods excel options (sheet_name='AGE');
proc freq data=sashelp.class;
tables age;
run;
ods excel close;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.