HTML Data Set Formatter

Formatting a Data Set in Batch Mode

If you prefer to enter code directly into your SAS program rather than use windows, use the Data Set Formatter in batch mode to convert a SAS data set into an HTML file. The following instructions describe how to invoke the Data Set Formatter and generate results in batch mode.

Rather than work in batch mode, you can work with Data Set Formatter interactively using windows. For information, see Formatting a Data Set Interactively.

To invoke the Data Set Formatter and format a data set into an HTML file:

  1. Type and submit %DS2HTM(RUNMODE=B, HTMLFILE=FILENAME); in the Program Editor. The argument RUNMODE=B indicates that the Data Set Formatter will run in batch mode. If you are including other arguments, include them inside the parentheses, for example:

         %ds2htm(runmode=b,
                 htmlfile=myfile.html,
                 data=saleall,
                 where=year eq 1996,
                 var=year quarter dept amt,
                 rowssvar=quarter,
                 sum=amt,
                 caption=1996 Sales Total per Department,
                 ssfile1=comments.txt);
    

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

  2. Specify general options that affect the processing of the data and the entire HTML page. The above example describes some of the arguments you can enter in the SAS program.

    For a complete description of all the Data Set Formatter arguments, required arguments, and syntax explanations, see HTML Data Set Formatter: Macro Syntax Reference.

  3. Select variables you want to appear in your HTML-formatted table. Use the var=var1 var2 ... argument.

  4. Optionally, select ID variables you want to appear in your HTML-formatted file. Using ID variables may be helpful if you want to distinguish certain variables from others. For example, you can use one color for ID variables and another for the other variables. Enter the following:

    id=var1 var2 ...
    specifies which SAS variables you want represented using the formatted values of the ID variables. List each variable name and separate them with a space. Do not use a comma in the list of variable names.
  5. Optionally, select SUM variables that appear as totals or sums in your HTML-formatted file. These variables must be numeric, not character. Use the sum=var1 var2 ... argument.

  6. Ensure that you included a comma after each argument and a semicolon at the end of the Data Set Formatter macro call.

  7. To format the data set, submit the program. The Data Set Formatter retrieves the data from the data set, adds the HTML tags, and creates the HTML-formatted file.

  8. You can change the properties that govern how the data appears in your HTML table.

  9. After processing the results, enter the URL (including the HTML filename) in the browser window to look at your HTML-formatted table.

    Note: You can run the program again using a different property list. Specify the list using the PROPLOC argument. For details, see the Macro Reference Syntax.