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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.