Creating an Animated Sequence


To create an animated sequence with the GIFANIM device driver, you need to ensure that the resulting data stream is constructed properly. The GIFANIM data stream has three parts : header, body, and trailer.

To see an example of a program that uses the GIFANIM device driver, see Sample Programs: GIFANIM on page 459.

Preparing the Header

When creating a new animated GIF data stream, you must issue GOPTIONS GSFMODE=REPLACE; prior to the invocation of the first SAS/GRAPH procedure. The driver will then construct a new data stream by writing a valid GIF header and inserting graphical data from the first procedure.

Preparing the Body

After the first procedure has been executed, you must construct the body of the GIF animation. You can think of the body as all of the graphic images between the first and the last images in the sequence. Set GOPTIONS GSFMODE=APPEND to suppress the header information and to begin appending graphic data to the current data stream. The GOPTIONS GSFMODE=APPEND statement must appear after the first and before second SAS/GRAPH procedures.

Note: If you use BY- group processing on the first graphics procedure to generate multiple graphs, then the output is automatically appended to the same GIF file. Thus, you do not need to specify GSFMODE=APPEND for that first procedure. If you do not use a second graphics procedure to append additional graphs to the GIF file, you do not need to set the GSFMODE= option in the body section of your program.

Preparing the Trailer

The final step in the GIF animation process is to mark the end of the animation by appending a GIF trailer ( 3B x) to the data stream. The way to do this depends on whether or not the last procedure uses BY-group processing.

  • Without BY-group processing, set GOPTIONS GEPILOG= 3B X before the last SAS/GRAPH procedure.

  • With BY-group processing, do not assign a value to GEPILOG; otherwise your GIF animation sequence will be incomplete. Because a GEPILOG is written after each graph in a BY-group, the GIF decoder will interpret the first 3B x as the end of the animation. Instead, you should use a DATA step to add the trailer to the data stream:

     data _null_;     file out recfm=n mod;     put '3B'x;  run; 

    In the preceding example, OUT is the fileref of the GIF output file.

After the animation is complete, issue a GOPTIONS RESET=ALL statement to prepare for succeeding SAS jobs.




SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net