Sample 40683: Streaming output from a SAS® Stored Process to Microsoft Excel
A common request is to produce output with a SAS® Stored Process that can be opened in Microsoft Excel. This sample illustrates a common approach that can be used from a Web based client application to either prompt the end user to OPEN or SAVE the .xls file or open the file in Excel with no prompt.
*ProcessBody;
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=test.xls');*/
/* OR */
/* Open results directly to Excel (browser-dependent) */
rc = stpsrv_header('Content-disposition',"inline");
run;
/* Use TAGSETS.EXCELXP if you want multiple worksheets in one file */
/* %let _ODSDEST=TAGSETS.EXCELXP; */
/* OR */
/* Use TAGSETS.MSOFFICE2K if you want to include graphics output */
%let _ODSDEST=TAGSETS.MSOFFICE2K;
/* Set ODS STYLE */
%let _ODSSTYLE=seaside;
/* Create output */
%stpbegin;
proc print data=sashelp.class;
run;
%stpend;
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.
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.
This short example illustrates a SAS® Stored Process that generates output for Microsoft Excel.
Type: | Sample |
Topic: | Query and Reporting ==> Creating Reports Query and Reporting ==> Interactive Querying Query and Reporting ==> Report Distribution Query and Reporting
|
Date Modified: | 2010-12-14 15:36:35 |
Date Created: | 2010-08-25 12:32:25 |
Operating System and Release Information
SAS System | SAS Integration Technologies | Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | |
Microsoft® Windows® for x64 | 9.2 TS2M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | |
z/OS | 9.2 TS2M0 | |
Microsoft Windows Server 2003 for x64 | 9.2 TS2M0 | |
Microsoft Windows Server 2008 for x64 | 9.2 TS2M0 | |
Microsoft Windows XP Professional | 9.2 TS2M0 | |
Windows Vista | 9.2 TS2M0 | |
Windows Vista for x64 | 9.2 TS2M0 | |
64-bit Enabled AIX | 9.2 TS2M0 | |
64-bit Enabled HP-UX | 9.2 TS2M0 | |
64-bit Enabled Solaris | 9.2 TS2M0 | |
HP-UX IPF | 9.2 TS2M0 | |
Linux | 9.2 TS2M0 | |
Linux for x64 | 9.2 TS2M0 | |
OpenVMS on HP Integrity | 9.2 TS2M0 | |
Solaris for x64 | 9.2 TS2M0 | |