This stored process sample attaches an Excel file (XLS) for downloading when you run the sample code from a stored process Web application or portal. The sample also provides code for downloading PDF and CSV files.
Code Sample Details
If you have the Stored process macros option checked when you create this sample in SAS Enterprise Guide, you might receive incorrect results. Since _WEBOUT is used in this example, it does not contain the %STPBEGIN and %STPEND macros. Because SAS Enterprise Guide does not detect these macros in the code, it will continue to prompt you.
As shown in the following display, make sure that you DO NOT have Stored process macros checked when you create this sample in SAS Enterprise Guide.
If the application prompts ask if you want to enable stored process macros, click No.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
/* Sample for downloading an Excel file. */
data _null_;
rc=stpsrv_header('Content-type','application/vnd.ms-excel');
rc=stpsrv_header('Content-disposition','attachment; filename=temp.xls');
run;
ods tagsets.excelxp file=_webout options(embedded_titles="yes"
embedded_footers="yes"
print_header='&B&CThis is a test'
print_footer='&B&CThis is a footer printed on &D');
title 'SASHELP.Class';
proc print data=sashelp.class;
run;
ods tagsets.excelxp close;
/* Sample for downloading a PDF file. */
data _null_;
rc=stpsrv_header('Content-type','application/pdf');
rc=stpsrv_header('Content-disposition',"attachment; filename=&filename..&outType");
run;
ods listing close;
ods pdf body=_webout;
proc print data=sashelp.class;
run;
ods pdf close;
/* Sample for downloading a CSV file. */
data _null_;
rc=stpsrv_header('Content-type','application/vnd.ms-excel');
rc=stpsrv_header('Content-disposition','attachment; filename=temp.csv');
run;
ods csv file=_webout;
proc print data=sashelp.class;
run;
ods csv close;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Date Modified: | 2008-10-01 15:15:55 |
Date Created: | 2008-07-08 11:07:55 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft® Windows® for x64 | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |||
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |||
Windows Vista | 9.1 TS1M3 SP4 |