Sample 25638: HTML Output Formatter Example
This example uses the HTML Output Formatter, one of the HTML Formatting Tools, to capture results generated by PROC REPORT.
Marking the Start of Capturing
To begin capturing the output, insert the Output Formatter
CAPTURE=ON statement. This captures all output until a
CAPTURE=OFF statement is encountered.
Next, insert a SAS TITLE statement that contains embedded HTML tags. These tags change the justification and appearance of the text that will display in the HTML-formatted pages.
Then, insert the PROC REPORT code, as indicated in the following example code. This procedure generates the output that is captured by the Output Formatter and displayed on the HTML page:
%out2htm(capture=on);
title1 '<CENTER> <FONT FACE=ARIAL SIZE=5 COLOR=BLUE>
Eastern US Sales Report</CENTER> </FONT>';
<Insert PROC REPORT code here>
Marking the End of Capturing
Insert an Output Formatter CAPTURE=OFF statement to stop capturing the output, as follows:
%out2htm(capture=off,
encode=n,
bgtype=image,
bg=map.jpg,
htmlfile=outrpt.html,
ttag=NO FORMATTING);
You can also specify the following arguments:
HTMLFILE=OUTRPT.HTML, which specifies the name of the HTML file.
ENCODE=N, which tells the Output Formatter not to encode the angle brackets in the SAS TITLE statement so that the Web browser can act on them as an HTML-formatting instruction. This enables the Web browser to render the title with the attributes specified.
BGTYPE=IMAGE, which indicates that you want to use an image as the background type. Specify the name of the image in the BG= argument.
TTAG=NO FORMATTING, which tells the Output Formatter not to assign HTML tags to the SAS title lines.
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.
The following code fragment is a portion of the program used to create the HTML-formatted file (htmlgen.outrpt.html).
%out2htm(capture=on);
title1 '<CENTER><FONT FACE=ARIAL SIZE=5 COLOR=BLUE>
Eastern US Sales Report</CENTER></FONT>';
<Insert PROC REPORT code here>
%out2htm(capture=off,
encode=n,
bgtype=image,
bg=map.jpg,
htmlfile=htmlgen.outrpt.html,
ttag=NO FORMATTING);
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.
A sample output file is available here.
This example shows the results captured by the HTML Output Formatter from PROC REPORT and converted into an HTML-formatted file.
| Type: | Sample |
| Topic: | Software Components ==> HTML Formatting Tools
|
| Date Modified: | 2006-12-05 03:02:52 |
| Date Created: | 2005-07-08 09:32:17 |
Operating System and Release Information
| SAS System | SAS/IntrNet | All | n/a | n/a |