Is there a way to use prompt values from the stored process in the sheet name of your ODS Tagsets.excelxp output?
Thanks,
Nate
Turns out if you put the ODS Tagsets statement AFTER the %stpbegin statement and exclude the BODY statement you can successfully use SHEET_NAME.
That's what I thought, but it seems my BODY statement overrides the SHEET_NAME statement and without the BODY statement nothing is generated.
Here is my output statement:
*ProcessBody;
%global _odsest _odsstyle _odsstylesheet;
%let _odsest=html;
*%let _odsstyle=analysis;
%let _odsstylesheet=;
data _null_;
/* Set HTTP headers */
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
/* Prompt to SAVE or OPEN the attachment file named test.xls using Excel */
rc = stpsrv_header('Content-disposition','attachment; filename=Open_Inventory_List.xls');
/* OR */
/* Open results directly to Excel (browser-dependent) */
/* rc = stpsrv_header('Content-disposition',"inline"); */
run;
ODS LISTING CLOSE;
*%let _ODSSTYLE=analysis;
ODS TAGSETS.ExcelXP options(sheet_name="&new_Client-&new_Sub_Client" sheet_interval="none" embedded_titles='yes') BODY="Open_Inventory_List" /*style=analysis*/;
%stpbegin;
...my proc print statement...
%stpend;
Try this simplified code:
*ProcessBody;
%let RV=%sysfunc(appsrv_header(Content-type,application/vnd.ms-excel));
%let RV=%sysfunc(appsrv_header(Content-disposition,attachment; filename="Open_Inventory_List.xml"));
ods _all_ close;
ods tagsets.ExcelXP file=_webout style=analysis;
ods tagsets.ExcelXP options(sheet_name="&NEW_CLIENT-&NEW_SUB_CLIENT"
sheet_interval='none'
embedded_titles='yes');
* Your proc print statement here;
ods tagsets.ExcelXP close;
Adapted from page 18 of this paper:
http://support.sas.com/resources/papers/proceedings15/SAS1700-2015.pdf
Vince DelGobbo
SAS R&D
Turns out if you put the ODS Tagsets statement AFTER the %stpbegin statement and exclude the BODY statement you can successfully use SHEET_NAME.
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.