You can invoke and use the HTML Tabulate Formatter by including macro calls in a SAS program. Including macro agrugments for the HTML Tabulate Formatter in a SAS program is referred to as running in "batch mode."
You can also use the Tabulate Formatter interactive window to capture 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.
The HTML Tabulate Formatter captures data differently when running in batch versus interactive mode. When running the HTML Tabulate Formatter interactively, you must generate the results and display them in the Output window before you can capture the information. When running in batch mode, you actually capture the output as it is being generated.
Using the macro in batch mode rather than using the HTML Tabulate Formatter window (interactive mode) is helpful when you have automated reporting programs that run unattended, and you want to display the output on the Web in HTML-formatted pages.
For a description of how to use the interactive mode, see Capturing Tabulate Output Interactively.
Complete the following steps before running the HTML Tabulate Formatter:
If you are running your SAS program as a batch process,
start the SAS session using the -NOTERMINAL
option.
Set your line size to less than or equal to 195 (for
example, OPTIONS LS=195
) in the OPTIONS
statement of your SAS program. This sets your line size to
195 characters or less, rather than the 200-character
limit. (You must submit this code first or start SAS with
this option. If you do not start SAS with this option, you
must clear the Output window before trying to submit code
to capture.)
Set SAS system options in your SAS program.
You must set the line size (ls=
) and FORMCHAR
(FORMCHAR=
) system options before you capture
output from the TABULATW procedure.
Use the following line to make sure that the ODS LISTING destination is open:
ods listing;
Complete the following to capture results:
Ensure that the your program generates output only from the TABULATE procedure. If your program generates output from any other SAS procedure, the HTML Tabulate Formatter will fail. To capture other types of output, use the HTML Output Formatter.
Include the following in your SAS program to turn on the capture mode for the HTML Tabulate Formatter. Include it at the location where you want to capture data.
%tab2htm(capture=on, runmode=b);
This indicates that you want to capture everything in the specified window until capture mode is turned off.
For every CAPTURE=ON
statement, you must
include a CAPTURE=OFF
statement. The
following shows an example of what you might type after
the portion of the results you want to capture:
%tab2htm(htmlfile=myfile.html, capture=off, openmode=replace, runmode=b);
where
htmlfile=
capture=off
openmode=APPEND | REPLACE
REPLACE
is the default action. It deletes
the information in an existing file and replaces it
with the new output. Specify
OPENMODE=APPEND
to override the default
and add your new HTML-enhanced output to the end of an
existing file. This argument is required only if you
want to override the default setting.runmode=I | B
RUNMODE=B
when running in batch mode to
avoid confusion. You must include the argument when
running in interactive mode.
Along with the CAPTURE=OFF
statement, include
arguments that specify unique attributes you want to
display in your HTML file. For example, specify the color
of the title, the type of separator between pages, the
font (face) for footnotes. (Tabulate Formatter ignores any
formatting arguments placed in the CAPTURE=ON
statement.) The formatting options you change in the macro
call override any stored in the property list.
Here's an example showing formatting options specified. This code will display red title lines and blue footnote lines.
%tab2htm(htmlfile=myfile.html, capture=off, openmode=replace, runmode=b, tcolor=red, fcolor=blue);
Using the HTML Tabulate Formatter's batch mode, you never see the results in the Output window. As soon as you submit the program, you capture the results as they are being generating.
To look at your HTML file, enter the URL (including the HTML filename) in your browser window.
If you want to use a property list other than the default,
include the PROPLOC
argument in the macro call when
you invoke the Tabulate Formatter:
%tab2htm(capture=off, runmode=b, proploc=property-list-name, other arguments...);
When specifying a property file, you must include the four-level property list name, for example, SASUSER.HTMLGEN.MYPROPS.SLIST, that specifies library, catalog, entry, and type. (The default property list is SASHELP.HTMLGEN.TABPROP.SLIST.)
Note: You can easily determine your current property settings by reviewing the appropriate property list for the Tabulate Formatter, for example, SASHELP.HTMLGEN.TABPROP.SLIST. This is the property list that is supplied by SAS for the HTML Tabulate Formatter. For instructions on how to display your current settings, see Reviewing Current Property Settings.