Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next

Creating Dispatcher Applications Using the Output Delivery System (ODS)

These three applications show how to use the Output Delivery System (ODS), available in Version 7 of SAS software, to integrate text and graphics into your HTML page.


The Input Component

These three samples use ODS and various SAS software procedures to generate HTML output that has integrated graphics and text. The purpose of these samples is to highlight some of the ways to integrate ODS with the Application Dispatcher. The only input controls are combo boxes that allow you to choose the type of service and the debug level.

The HTML code for these applications are installed with the Dispatcher package in default locations at

http://yourserver/sasweb/IntrNet8/dispatch/webods1.html
http://yourserver/sasweb/IntrNet8/dispatch/webods2.html
http://yourserver/sasweb/IntrNet8/dispatch/webods3.html

The Program Component

General Information

To begin generating HTML output by using ODS, submit this statement:

   ods html ods-options path=&_tmpcat (url=&_replay) rs=none;

The ODS options control the type and destination of the HTML output that is generated by your program. At the end of your program, include this line of code:

   ods html close;

The SAS source code for your program is placed between these two ODS statements. For more detailed information about using ODS with the Application Dispatcher, refer to The Output Delivery System (ODS).

Sample 1: 3-D Bar Chart with Drill-Down Capability

This sample illustrates how to integrate text and graphics into a single page, and also shows how you can add drill-down capability to the graphic.

In order to provide drill-down capability to a graphic, the SAS data set that will be used as input to the graphic procedure must have a special format. This involves defining a character variable whose value is the URL that will be accessed when the appropriate portion of the graphic receives a click event. The code below, which was extracted from the sample program, illustrates one way to generate this variable. The variable HREF contains the final URL.

   if first.region then rnumber + 1;
   file  = "region" || trim(left(put(rnumber, 4.0))) || ".html";
   href  = 'href="' || &_replay || trim(file) || '"';

Use the GCHART procedure to generate the horizontal 3-D bar chart. Note that the variable HREF, which was created in the code fragment shown above, is specified as the value for the HTML option. This controls the drill-down behavior for the graphic that is generated.

   proc gchart data=work.shoes;
      hbar3d product / sumvar=sales
         subgroup=region
         shape=cylinder
         html=href
         percent
         patternid=subgroup
         legend=legend1;
      label product='Shoe Style';
   run;
   quit;

In this sample, when a portion of the graphic receives a click event, another HTML page is presented in the Web browser window. These HTML pages are also created by ODS using the REPORT procedure.

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

Sample 2: Report with Embedded Graphic Images

This sample illustrates how to further integrate graphics and text into a single HTML page.

Use the GCHART procedure to generate the appropriate graphic images and store them in a temporary SAS catalog. The REPORT procedure then accesses these images and through ODS, embeds the images into the report. The code fragment below shows what is needed to embed the images.

   if( qtr = 1 ) then
      call define( _ROW_, "GRSEG", "&_tmpcat..gchart" );
   else if (qtr = 2 ) then
      call define( _ROW_, "GRSEG", "&_tmpcat..gchart1" );

The TABULATE procedure is also used to generate a report. The use of ODS styles is illustrated in both the REPORT and the TABULATE code.

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

Sample 3: Table of Contents and 3-D Graphics

This sample illustrates how ODS can be used to generate a Table of Contents for your SAS software output and also how to generate 3-D pie charts.

Use the GCHART procedure to generate the 3-D pie charts. ODS automatically generates a Table of Contents because the CONTENTS keyword was specified in the ODS statement. For example,

   ods html contents=_webout (dynamic)
      body=b.html
      path=&_tmpcat (url=&_replay)
      rs=none;

When an anchor in the Table of Contents receives a click event, the corresponding pie chart will be displayed in the Web browser window.

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


Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next