This example SAS® Stored Process creates a report in multiple output formats. It creates the same report in PDF, HTML and CSV output format using ODS.
When you click a link, you can view the output in the format that you select.
The sample produces output that is similar to the following.
Click a link to view your report in a specific output format.
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.
/*****************************************************************************/
/* */
/* Name: Download_Multiple_Formats.sas */
/* */
/* Purpose: This SAS Stored Process creates a report in multiple output */
/* formats (PDF, HTML and CSV) and saves the output files in the */
/* SAVE session library so they can be retrieved later. */
/* */
/* It also creates an HTML file that contains links to */
/* the output files. When the user clicks on one of the links, */
/* the appropriate file will be returned to the user. */
/* */
/* Notes: The SAS Stored process must create Stream output. */
/* */
/*****************************************************************************/
data _null_;
file _webout;
put "<html>";
put "<h2>Your Report is available in multiple output formats</h2>";
put "The output files were saved in the SAVE session library.";
length url_value $1024;
put "<br>";
/* Create URL link to the PDF file. */
url_value = '<p>View the <a href="' || &_REPLAY || 'myfile.pdf">PDF file</a></p>';
put url_value;
/* Create URL link to the HTML file. */
url_value = '<p>View the <a href="' || &_REPLAY || 'myfile.html">HTML file</a></p>';
put url_value;
/* Create URL link to the CSV file. */
url_value = '<p>View the <a href="' || &_REPLAY || 'myfile.csv">CSV file</a></p>';
put url_value;
put '</HTML>';
run;
/* Save the output files in the SAVE Session library so they can be retrieved later. */
filename mypdf catalog "&_TMPCAT..myfile.pdf";
filename myhtml catalog "&_TMPCAT..myfile.html";
filename mycsv catalog "&_TMPCAT..myfile.csv";
ods pdf body=mypdf ;
ods html body=myhtml;
ods csv body=mycsv;
proc print data=sashelp.class;
run;
ods pdf close;
ods html close;
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: | 2012-03-26 09:50:58 |
Date Created: | 2012-03-09 12:37:09 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS Integration Technologies | z/OS | 9.2 TS2M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | |||
Microsoft® Windows® for x64 | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Standard Edition | 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 |