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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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