Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next

Frequency Procedure

This application shows how to display output from a SAS procedure as well as the raw data that was used by that procedure.


The Input Component

This sample uses both the HTML Output Formatter and the HTML Data Set Formatter, two of the HTML Formatting Tools that are provided by SAS, to create an HTML-formatted table. This tool will produce all of the HTML output for this application.

The form contains radio buttons that give the user control over what type of two-way frequency analysis is performed.

   <INPUT TYPE=RADIO NAME="table" value="city*dept" CHECKED>City by Dept<BR>
   <INPUT TYPE=RADIO NAME="table" value="city*week">City by Week<BR>
   <INPUT TYPE=RADIO NAME="table" value="dept*week">Dept by Week<BR>

There are also combo boxes that allow you to choose the type of service and the debug level.

The HTML code for this application is installed with the Dispatcher package in a default location of http://yourserver/sasweb/IntrNet8/dispatch/webfreq.html.


The Program Component

The SAS code to process this form is again made easy by using the HTML Formatting Tools. These tools can be used in Dispatcher programs to provide power and flexibility while saving you a lot of programming effort.

The Output Formatter is invoked by calling the macro %out2htm and supplying it with a set of arguments. To begin capturing SAS procedure output, specify the argument capture=on. When all of the desired SAS procedure output has been generated, run %out2htm again, this time specifying the capture=off argument.

Here is the source code illustrating this technique, which was extracted from the Dispatcher program:


   %out2htm(capture=on);

   PROC FREQ code goes here

   %out2htm(capture=off,
      htmlfref=_webout,
      runmode=s,
      openmode=replace,
      bgtype=color,
      bg=white,
      tcolor=blue,
      brtitle=Sample Procedure Output);

The argument RUNMODE=S instructs the Output Formatter to print the required HTTP header before creating any output. We could have used a DATA step to do this, but the RUNMODE argument is more convenient.

Another requirement of all Dispatcher programs is to make sure that the output is directed to the fileref _WEBOUT. The Formatting Tools accept the argument HTMLREF=. Supplying a value of _WEBOUT for this argument directs the Formatter output to the Web browser.

The HTML form for this program allows the user to choose the type of two-way frequency analysis that is performed. When the Submit button is pressed on the form, the browser passes the name/value pairs as NAME=VALUE to the Broker. For example, if you chose "City by Week" for the table to display, the name/value pair table=city*week is passed.

Additionally, the raw data used by the FREQ procedure is displayed using the Data Set Formatter. Below is the code that was used:

   %ds2htm(data=jan,
      htmlfref=_webout,
      openmode=replace,
      clbgcolr=#c0c0c0,
      caption=Raw Data,
      ccolor=blue,
      ctag=header 3);

Note that the argument RUNMODE=S was not supplied with the call to %ds2htm. This is because the Output Formatter had already supplied the required HTTP header.

The complete code for this Dispatcher program is installed in the Application Server sample library in a file named webfreq.sas.


Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next