HTML Tabulate Formatter

Capturing Tabulate Output in Batch Mode

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.

Before Invoking the HTML Tabulate Formatter

Complete the following steps before running the HTML Tabulate Formatter:

  1. If you are running your SAS program as a batch process, start the SAS session using the -NOTERMINAL option.

  2. 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.)

  3. 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.

  4. Use the following line to make sure that the ODS LISTING destination is open:

       ods listing;
    

Capturing Results

Complete the following to capture results:

  1. 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.

  2. 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.

  3. 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=
    specifies the HTML file to which the results are saved. Make sure you enter a fully-qualified path and filename. This is required when you turn capturing off.

    capture=off
    turns capturing off.

    openmode=APPEND | REPLACE
    indicates whether the new HTML output overwrites the information currently in the specified file or if the new output is appended to the end of the existing file. 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
    specifies whether you are running the macro in batch or interactive (window) mode. Although the default is to run the macro in batch mode, you should include 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);
    
  4. Submit the program.

    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.

  5. To look at your HTML file, enter the URL (including the HTML filename) in your browser window.

Specifying the Property List in Batch Mode

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.