I want to create an excel file with two tabs, sheet1 and sheet2. I want table1 and table2 data on a tab and table3 data in the another tab. Below is my code. I tried all options for sheet_interval. The 'sheet_interval = none' option create one tab with three tables. All the other options (page, bygroup, table and proc) create three tabs. The table1 and table2 data come on two different tabs.
Thanks for your help!
*******************************************************************************************************************************
ods listing close;
ods tagsets.ExcelXP style=journal file="excel_file.xls"
options(sheet_name=sheet1' autofilter='none' orientation='landscape'
sheet_interval='none'
SKIP_SPACE= '5');
proc print data=table1 noobs
style(header) = { font_style=italic font_weight = bold font_face = "calibri" font_size = 10pt just = c}
style(data) = {font_face = "Calibri" font_size = 10pt background=$nfmt.foreground=white};
run;
proc print data=table2 noobs
style(header) = { font_style=italic font_weight = bold font_face = "calibri" font_size = 10pt just = c}
style(data) = {font_face = "Calibri" font_size = 10pt};
run;
ods tagsets.ExcelXP options(sheet_name='sheet2' autofilter='all' orientation='landscape'
frozen_headers='Yes');
proc print data=table3 noobs
style(header) = { font_style=italic font_weight = bold font_face = "calibri" font_size = 10pt just = c}
style(data) = {font_face = "Calibri" font_size = 10pt};
ods tagsets.ExcelXP close;
**********************************************************************************************************
This should work:
ods tagsets.excelxp file="s:\temp\rob\temp.xml" options(sheet_interval="none" sheet_name="First"); proc report data=sashelp.class nowd; columns _all_; run; proc report data=sashelp.class nowd; columns _all_; run; ods tagsets.excelxp options(sheet_interval="table" sheet_name="Next"); proc report data=sashelp.class nowd; columns _all_; run; ods tagsets.excelxp close;
Thanks a lot! That worked.
Using the following line will tell Excel to start a new sheet. Anything that follows this should be on the same tab. If you want three sheets, you'd have two of these lines - one before the code for each tab, and the initial statement of options.
ods tagsets.excelxp options(sheet_interval='none');
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.
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.