BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

2 REPLIES 2
pink_poodle
Barite | Level 11

 

 

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;

 

Tom
Super User Tom
Super User

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1132 views
  • 3 likes
  • 3 in conversation