Chapter Contents

Previous

Next
SAS/GRAPH Software: Reference

Example 6: Creating a GIF Animation File

This example creates a GIF animation using regional sales data. BY-group processing is used to generate three bar charts, one chart each to represent sales figures for three sales regions. When the output GIF file is viewed in a browser, the charts are displayed in a timed sequence. To speed up the animation, decrease the setting for the DELAY= graphics option. To slow down the animation, increase the setting for the DELAY= graphics option.

/* assign the destination for the output */
filename out 'external-file.gif';

/* set the graphics environment */
goptions reset=global gunit=pct border
   cback=ligr ctext=black
   colors=(blue green red) ftext=swissb
   ftitle=swissb htitle=6 htext=5;

/* assign graphics options for the animation */
goptions display
         dev=gifanim
         gsfname=out
         gsfmode=replace
         iteration=0
         delay=200;

/* create data set REGSALES */
data regsales;
  length Region State $ 8;
  format Sales dollar8.;
  input Region State Sales;
  datalines;
West CA 13636
West OR 18988
West WA 14523
Central IL 18038
Central IN 13611
Central OH 11084
Central MI 19660
South FL 14541
South GA 19022
;

/* sort the data set */
proc sort data=regsales out=regsales;
by region;
run;

/* generate the charts */
title1 'Company Sales';
proc gchart data=regsales;
   vbar state / sumvar=sales
   patternid=by;
by region;
run;
quit;

/* end the animation */
data _null_;
   file out recfm=n mod;
   put '3B'x;
run;

goptions reset=all;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.