HTML Output Formatter

Capturing Output in Batch Mode

You can invoke and use the Output Formatter by entering macro calls in a SAS program. You enter arguments to the macro calls to specify formatting options. This method is referred to as running 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.

Using the macro in batch mode rather than the Output Formatter window (in interactive mode) is helpful when

For a description of how to use the interactive mode, see Capturing Output Interactively.

Before Invoking the Output Formatter

Complete the following steps before you invoke the Output Formatter:

  1. Enter or display your program in the Program Editor.

  2. Set SAS system options in your SAS program to produce results successfully.

    • 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 Log and Output windows before trying to submit code to capture.)

    • The SAS FORMCHAR= system option specifies the formatting characters displayed in your output. Formatting characters are used to construct tabular output outlines. If you do not use this option in your SAS code, the characters that delineate the table may look unusual, depending on your browser and the operating system or platform used. To avoid this and to specify exactly which characters to use, set the following SAS system option prior to capturing any output with Output Formatter:

          OPTIONS FORMCHAR='|----|+|---+=|-/\<>*';
      
  3. Use the following line to make sure that the ODS LISTING destination is open:

       ods listing;
    

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

Capturing Results

Complete the following to capture results:

  1. Include the following in your SAS program to turn on the capture mode for the Output Formatter. Include it at the location where you want to capture data.

    %out2htm(capture=on,
             window=log|output,
             runmode=b);
    

    This indicates that you want to capture everything in the specified window until capture mode is turned off.

  2. For every CAPTURE=ON statement, you must include a CAPTURE=OFF statement. You must also include a CAPTURE=OFF statement that matches the specified window. The following shows an example of what you might type after the portion of the results you want to capture:

        %out2htm(htmlfile=myfile.html,
                 capture=off,
                 window=log|output,
                 openmode=replace,
                 runmode=b);
           
    

    See Macro Syntax Reference for a description of each of the arguments in the previous example. The syntax reference describes every option that you can use with the Output Formatter.

    Along with the CAPTURE=OFF statement, include any other attributes that define the formatting characteristics of your page. For example, specify the color of the title, the type of separator between pages, the font (face) for footnotes. (Output Formatter ignores any formatting arguments placed in the CAPTURE=ON statement.) The formatting options you change in the macro call override any set using the HTML Formatter Properties window.

    Here's an example showing formatting options specified. This code will display red title lines, green footnote lines, and blue header lines.

          %out2htm (htmlfile=myfile.html,
                    capture=off,
                    window=log|output,
                    openmode=replace,
                    runmode=b,
                    tcolor=red,
                    fcolor=green,
                    hcolor=blue);
    
  3. Submit the program.

    Using the Output Formatter's batch mode, you never see the results in the Output or Log window. As soon as you submit the program, you capture the results as they are being generating.

  4. 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 specific property list, include the PROPLOC argument in the macro call when you invoke the Output Formatter:

        %out2htm(capture=off,
                 window=log|output,
                 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.OUTPROP.SLIST.)