BookmarkSubscribeRSS Feed
Harry
Obsidian | Level 7
I’m having difficulty creating the 1st summary sheet with a specific name, and then automatically naming subsequent sheets with the BY variable value. If I don’t include the summary sheet, the BY sheets are as desired, F & M, but it seems if I’ve specified a sheet_name value once, that’s the one that’s used for a subsequent sheets. Or, if I specify a blank sheet_name in the 2nd ODS statement, the subsequent sheets are numbered consecutively, 2 & 3 and are not named with the BY variable value.

How do I get three sheets, first one “All”, second “F”, third “M” ? I downloaded the latest tagset, no difference.

NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.94, 09/09/12).

title 'Want 1st sheet All, rest to be bygroups';

ods listing close;
ods tagsets.excelxp
file = "c:\temp\tagsets_sheetname.xls"
style = seaside
options ( embedded_titles = 'Yes'
sheet_name = 'All'
sheet_interval = 'bygroup'
sheet_label = ' '
suppress_bylines = 'yes'
)
;

proc print data = sashelp.class noobs;
run;

ods tagsets.excelxp
options ( sheet_interval = 'bygroup'
sheet_label = ' '
sheet_name = ' '
suppress_bylines = 'yes'
)
;

proc sort data = sashelp.class
out = class;
by sex;
run;

proc print data = class noobs;
by sex;
run;

ods tagsets.excelxp close;
ods listing;
3 REPLIES 3
data_null__
Jade | Level 19
See if the modification works for you

[pre]
ods tagsets.excelxp
options ( sheet_interval = 'bygroup'
sheet_label = ' '
sheet_name = 'none'

suppress_bylines = 'yes'
)
;
[/pre]
Peter_C
Rhodochrosite | Level 12
That is almost perfect!
It shows the title line just once for each PROC so no title shows after the first by-group on the second PROC PRINT.
Is that because I'm working with excelXP v1.94?
Are later releases able to surface titles for every by-group?

peterC

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 919 views
  • 0 likes
  • 3 in conversation