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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.