I'm doing something that I was hoping would be straightforward, but I'm finding it difficult to get to the "right" answer. I have a report that I'm creating for a hospital system. The report consists of 4 separate proc report statements. I am able to put them all on one tab for a single facility. However, when I try to have each set of 4 reports into separate tabs of the same workbook, I can't figure out which option I need to use. My current workaround is to have each tab written out as separate worksheets. This requires me to put it back together manually, which I would like to avoid.
The tagset statement I"m using is:
ods tagsets.ExcelXP file="&datadir\&hosp..xml"
style = printer
options(embedded_titles='yes'
sheet_interval='none'
skip_space='0,0,0,1,1'
sheet_name="&hospname"
/*doc='help'*/)
;
I'm open to all suggestions.
Sheet_name works fine for me.
ods tagsets.excelxp file='C:\_localdata\sample.xml' options(sheet_interval='none' sheet_name='Test1') style=meadow;
proc freq data=sashelp.class;
table age;
table sex;
run;
ods tagsets.excelxp options(sheet_interval='none' sheet_name='Test2');
proc means data=sashelp.class;
run;
ods tagsets.excelxp close;
Try Sheet_interval = "Proc"
You can change control the breaks with options and sheet_interval.
ods tagsets.excelxp file='C:\_localdata\sample.xml' options(sheet_interval='none') style=meadow;
proc freq data=sashelp.class;
table age;
table sex;
run;
ods tagsets.excelxp options(sheet_interval='none' sheet_label='Test');
proc means data=sashelp.class;
run;
ods tagsets.excelxp close;
Thanks for your reply. This gave me interesting results. Indeed, two tabs were created, but the tabs were labeled "Job 1 - Freq" and "Test 2 - Means"
I'm not sure where SAS is getting those names...
There are tagsets options (Sheet_name, Sheet_label) to control the excel tab names...I didn't attempt to change them as that was not your question.
Sheet_name works fine for me.
ods tagsets.excelxp file='C:\_localdata\sample.xml' options(sheet_interval='none' sheet_name='Test1') style=meadow;
proc freq data=sashelp.class;
table age;
table sex;
run;
ods tagsets.excelxp options(sheet_interval='none' sheet_name='Test2');
proc means data=sashelp.class;
run;
ods tagsets.excelxp close;
The sheet_interval along with the sheet_name is what makes it work.
Thanks so much!!!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.