With the HTML Output Formatter, you capture SAS output, format that output using HTML tags, and save it to an HTML file. You can capture information from the SAS software Output or Log window. A predefined set of attributes, called properties, governs the formatting applied to the output. You can generate custom output by creating your own property list. You can also use PUT and FILE statements to further customize your reports and other output.
You can use the Output Formatter macro in batch mode or in interactive mode. Using batch mode implies that you include the macro call in your SAS program. When you work interactively, you are using the FRAME interface to the Output Formatter Formatter. The interactive interface is available only with the 6.12 production release of SAS software.
To see how quickly you can create Web files from SAS output, take a look at the Output Formatter usage examples. For complete information on how to use HTML Formatting Tools, read the product documentation listed on the HTML Formatting Tools main page.
The features of the Output Formatter give you flexibility in creating SAS output for distribution on the Internet or an Intranet. Note that you can use the Output Formatter to place your output on a Web server (referred to as "publishing" your output). (To do this, you enter a File Transfer Protocol script. For details, see Tips and Techniques.)
The enhanced PUT and FILE support enables you to assign any of the nine
line attribute types to a line in your output. You can quickly augment
the HTML formatting instructions assigned to parts of your output by
including line attribute types using PUT statements. To customize
your HTML output, use PUT and FILE statements in your SAS program then
specify putnfile=Y
when
you run the macro. (You can also turn on PUT and FILE support when
running the formatter interactively.)
To implement PUT and FILE support, the Output Formatter requires some special formatting in your PUT statement. See Guidelines for Implementing PUT and FILE Support.
If your SAS program contains PUT statements that do not adhere to the guidelines presented here, make sure that you have PUT and FILE support turned off! When PUT and FILE support is turned off, the output from your PUT statements is processed as it has always been.
If you want to take advantage of the additional formatting capabilities offered by the PUT and FILE support, make sure that your SAS program adheres to the following guidelines. Examples are provided to help you better understand these guidelines.
The FILE statement uses PRINT as the fileref.
If you have PUT and FILE support turned on, the Output Formatter reads the character in column one to determine the line attribute type and removes that character from the output. Therefore, the first character in the PUT statement must be one of the following line attribute types:
B | defines a BY line. |
D | defines a data line. |
E | defines a error line. |
F | defines a footnote line. |
H | defines a header line. |
N | defines a note line. |
S | defines a source line. |
T | defines a title line. You do not need to specify the line attribute type for lines generated by the SAS TITLE statements. |
W | defines a warning line. |
All new physical lines in the output must have a line type assigned to it, even if they are generated by a single PUT statement. See Example 2.
If you create a blank line using a PUT statement and you do not specify a line type, the Output Formatter assumes that line to be a data line.
The following fragments of SAS code demonstrate how to incorporate the enhanced PUT and FILE support of the Output Formatter into your SAS programs.
title 'Report Title'; data _null_; file print; <omitted SAS code> header: put 't My special title'; put 't'; put 'HObs. Date Sales Month'; put 'h---- ---- ----- -----'; put 'h'; return; footer: put 'F'; put 'fThis is my footnote line'; return; run;
In Example 1, notice that your line type indicators can be either upper or lower case. Also notice that we have assigned a line type to our blank lines. If we had not assigned a line type, the blank line would be formatted as a data line.
In this example code, both Report Title and My special title are formatted using the HTML tags defined for a title line. The line This is my footnote line is formatted using the HTML tags defined for footnotes. (These definitions are specified in the property list.)
if last.state then do; alltot=mtot+etot; put 'd' @52 '------' @65 '------' / 'd' @26 'Total for each category' @52 mtot 6.1 @65 etot 6.1 / 'd' @35 'Combined total' @59 alltot 6.1; end;
Example 2 demonstrates how to format multiple lines of text with one PUT statement. Notice that each time a PUT statement causes a new line to be generated, a line type identifier is included before beginning the text of the new line. If you are simply breaking the line to make your program easier to read, you do not need to reissue the line type identifier.
In Example 2, all of the lines in the PUT statement are formatted using the same line type. This is not necessary. You can mix the line types in a single PUT statement. See Example 3.
put 't' @16 'Morning and Evening Newspaper Circulation' @67 '<FONT COLOR=purple>Page ' pagenum '</FONT>' / 'd' / 'h' @7 'State' @26 'Year' @51 'Thousands of Copies' / 'h' @51 'Morning Evening' ;
Example 3, like Example 2, demonstrates how to format multiple
lines with one PUT statement. Notice that within the one PUT
statement, we use three different line type attributes. The
second line of Example 3 shows that you can also include HTML
tags within your PUT statement. Remember to set ENCODE=N
if you are going to do this.