When running the SAS Stored Process Server it is possible to create a PDF file, a CSV file, or an RTF file for downloading to a Web browser. The examples below illustrate methods for creating these files.
The following examples contain six separate stored processes which must be run separately. Only one file can be downloaded at a time in a user request.
NOTE: SAS® Web Report Studio does not support the approach that is described in this SAS Note.
/* Example 1: Create a PDF file for downloading */
*ProcessBody;
data _null_;
rc = stpsrv_header('Content-type','application/pdf');
rc =
stpsrv_header('Content-disposition','attachment; filename=temp.pdf');
run;
ods listing close;
ods PDF body=_webout ;
proc print data=sashelp.class;
run;
ODS PDF CLOSE;
/* Example 2: Create a CSV file for downloading */
*ProcessBody;
data _null_;
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
rc =
stpsrv_header('Content-disposition','attachment; filename=temp.csv');
run;
ods listing close;
ods CSV body=_webout ;
proc print data=sashelp.class;
run;
ODS CSV CLOSE;
/* Example 3: Create an RTF file for downloading */
*ProcessBody;
data _null_;
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
rc =
stpsrv_header('Content-disposition','attachment; filename=temp.rtf');
run;
ods listing close;
ods RTF body=_webout ;
proc print data=sashelp.class;
run;
ods rtf close;
/* Example 4: Create a PDF file for downloading using */
/* %STPBEGIN and %STPEND */
*ProcessBody;
data _null_;
rc = stpsrv_header('Content-type','application/pdf');
rc =
stpsrv_header('Content-disposition','attachment; filename=temp.pdf');
run;
%let _odsdest=pdf;
%stpbegin;
proc print data=sashelp.class;
run;
%stpend;
/* Example 5: Create a CSV file for downloading using */
/* %STPBEGIN and %STPEND */
*ProcessBody;
data _null_;
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
rc = stpsrv_header('Content-disposition','attachment; filename=temp.csv');
run;
%let _odsdest=csv;
%stpbegin;
proc print data=sashelp.class;
run;
%stpend;
/* Example 6: Create a HTML file for downloading to Excel. */
/* Using %STPBEGIN and %STPEND */
*ProcessBody;
data _null_;
rc = stpsrv_header('Content-type','application/vnd.ms-excel');
rc = stpsrv_header('Content-disposition','attachment; filename=report.xls');
run;
%stpbegin;
proc print data=sashelp.class;
run;
%stpend;
Operating System and Release Information
SAS System | SAS Integration Technologies | 64-bit Enabled HP-UX | 9.1 TS1M2 | |
Microsoft Windows NT Workstation | 9.1 TS1M2 | |
Microsoft Windows XP Professional | 9.1 TS1M2 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M2 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M2 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M2 | |
Microsoft Windows 2000 Server | 9.1 TS1M2 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M2 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M2 | |
Microsoft Windows 2000 Professional | 9.1 TS1M2 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M2 | |
HP-UX IPF | 9.1 TS1M2 | |
Linux | 9.1 TS1M2 | |
z/OS | 9.1 TS1M2 | |
64-bit Enabled Solaris | 9.1 TS1M2 | |
OpenVMS Alpha | 9.1 TS1M2 | |
64-bit Enabled AIX | 9.1 TS1M2 | |
Tru64 UNIX | 9.1 TS1M2 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.