The Output Formatter lets you easily format and save output from SAS procedures into HTML files. The following instructions describe how to invoke the Output Formatter and capture results from the SAS software Output or Log window.
There are two ways to work with the Output Formatter:
You can use the Output Formatter interactive window to capture procedure results. This method is referred to as running in "interactive" mode or using a "frame," as the window is constructed using SAS/AF FRAME technology. On the other hand, you can enter an Output Formatter macro call directly in a SAS program. This is referred to as running in "batch mode." For details, refer to Capturing Output in Batch Mode.
The Output Formatter captures data differently when running in batch versus interactive mode. When running the Output Formatter interactively, you must generate the results and display them in the Output or Log window before you can capture the information. When running in batch mode, you actually capture the output as it is being generated.
Complete the following steps before you display the Output Formatter window:
Enter or display your program in the Program Editor.
Set SAS system options in your SAS program.
You must set the line size (ls=
) and FORMCHAR
(FORMCHAR=
) system options before you capture
output.
Use the following line to make sure that the ODS LISTING destination is open:
ods listing;
Ensure that the Output or Log window contains only the information that you want to capture. (The Output Formatter captures all results in the window.) If necessary, clear the window before submitting the program.
Submit the program. SAS software writes log messages to the Log window and your results to the Output window.
To invoke the HTML Output Formatter window, submit the following code in the Program Editor:
%OUT2HTM(RUNMODE=I);
The HTML Output Formatter window appears.
In addition to RUNMODE=I
, you can include the
following arguments when you invoke the HTML Output Formatter
window. Many of the arguments in the following table are not
available in the HTML Output Formatter window. The only way to
specify the information represented by these arguments is to
include them with your macro invocation. If you specify an
argument that is available in the window, the window will
reflect the argument value that you supplied with the macro
invocation. See the syntax reference
for information about how to specify each of these arguments.
htmlfile
|
saspower
|
fclass
|
sshref1-sshref5
|
openmode
|
putnfile
|
hclass
|
sstype1-sstype5
|
doctype
|
charset
|
nclass
|
ssrel1-ssrel5
|
pagepart
|
tranlist
|
sclass
|
ssrev1-ssrev5
|
brtitle
|
bclass
|
sepclass
|
sstitle1-sstitle5
|
proploc
|
bdclass
|
spclass
|
ssmedia1-ssmedia5
|
encode
|
dclass
|
tclass
|
ssfile1-ssfile5
|
window
|
eclass
|
wclass
|
ssfref1-ssfref5
|
To capture output interactively, complete the Output Formatter window.
Note: You cannot use macro variables, macro invocations, or
macro functions (including %NRSTR
) in any of these
fields because they will not resolve. However, you can use them
when running this tool in batch mode.
Enter information in the following fields on the Output Formatter window:
HTML File Name: Specify a filename to which your HTML-formatted output will be written. Type the fully-qualified path and filename, or select the arrow button to the right of the field to browse your directory structure.
Property List Name: The name of the property list that governs the format of your output appears here. SASHELP.HTMLGEN.OUTPROP.SLIST is the default property list. To use another property list, type the complete four-level name, or click on the arrow button to choose from a list.
You can change the formatting rules by creating a different property list. For details, see Customizing Properties.
Browser Window Title: Enter the text you want to appear as the title in the browser window title bar.
Transcoding List Name: Specify the name of the list that you want to use to transcode your data from one encoding to another. This field is optional. However, if you provide a transcoding list name, you may also need to provide a Character Set Name.
You can use a list that we provide or one that you create using MAKETL macro. For more information, see National Language Support.
Open Mode: To append new data to an existing HTML file, select Append. (If you select Append, you must specify an existing file in the HTML File Name field.) To replace existing data, select Replace.
Window: You can capture information in either the SAS Output or Log window. By default, you capture information in your Output window. To capture Log window data, select the Log option.
Encode: To have Data Set Formatter check for the characters "<" and ">" and encode them as Numeric Character References (NCR), select Yes. This will display the actual brackets in the browser. By default, the brackets will be encoded. To have Output Formatter pass the brackets as is to the browser (where the browser attempts to act on them as an HTML-formatting instruction), select No.
Character Set Name: Enter the name of the character set should appear in the <META> tag in your HTML file. Character set names vary based on the browser you are using. Therefore, the Formatting Tools do not perform any error checking on this value.
PUT and FILE: Select Yes if you have included PUT and FILE statements in your SAS program that take advantage of the PUT and FILE enhancements provided by the Output Formatter. The default selection for this option is No.
For more information, see PUT and FILE Support.
To capture the output in the specified window, select OK. The Output Formatter captures the data, adds the HTML tags, and writes it to the HTML file.
To look at your HTML file, enter the appropriate URL in your browser window.
The HTML Output Formatter window includes the following push buttons. If you have omitted a required field, an error message appears at the top of the window, and the cursor is positioned in the appropriate entry field.
When you use the Output Formatter interactively, it captures the output the is currently displayed in your Output or Log window. As long as the output you want to capture remains in the window, you can capture it over and over again using different property settings.
All you need to do is create a custom property list, specify the name of that list in the Property List Name field, modify the property settings, then select OK. You can continue modifying the properties and recapturing your output until you get the look you desire for your output -- without rerunning your SAS procedure.