Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next

Creating Dispatcher Applications Using Animated GIF

This application shows how to create an animated GIF image by using SAS/GRAPH software.


The Input Component

This sample uses PROC GCHART and the GIFANIM graphics driver to create an animated vertical bar chart. The only input controls are combo boxes that enable you to choose the type of service and the debug level.

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

The Program Component

The GIFANIM device driver is a special SAS/GRAPH driver that can be used to generate animated GIF-format images. These images are supported by the most popular Web browsers. The GOPTIONS statement is used to set the name of the device driver, as well as other parameters used by the SAS/GRAPH procedures:

   goptions dev=gifanim gsfname=_webout gsfmode=replace gcopies=0
      htext=1.5 gwait=30 hsize=5 vsize=5 cby=red hby=2 fby=swiss
      ftext=swiss horigin=0 vorigin=0 hpos=177 vpos=73;

In the above code, the graphics device driver is set to gifanim, and the GSFNAME parameter instructs the graphics procedures to write generated output to the fileref _WEBOUT. Other parameters control the size and appearance of the graphic that is produced.

Prior to sending any graphics back to the Web browser, you must send the HTTP content-type header to the browser. This is accomplished by using the following DATA step:

   data _null_;
      file _webout;
      put 'Content-type: image/gif';
      put;
   run;

In the sample program, the GCHART procedure generates a graphic image for every BY group represented in the data. Each graphic image is appended to the previously generated image, and the Web browser cycles through each image. To mark the end of the animation sequence, you must submit the following code:

   data _null_;
      file _webout;
      put '3b'x;
   run;

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


Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next