Chapter Contents |
Previous |
Next |
SAS/GRAPH Software: Reference |
Before using the GIFANIM device driver, you should become familiar with the animation process, the controls available, and certain limitations. The driver counts on you to control the process so that the animated sequence will be constructed properly.
For an example, see Example 6: Creating a GIF Animation File.
GIF Animation Process |
The process involved with creating an animated GIF with
the GIFANIM driver requires that you, the animator, take control of the job
sequence and ensure that the resulting data stream is constructed properly.
The GIFANIM data stream has three parts: Header, Body, and Trailer. Each portion
of the data stream is equally important and must be present. Otherwise, an
incomplete or unreadable animation sequence will result.
When creating a new animated GIF data stream, you must
issue GOPTIONS GSFMODE=REPLACE prior to the invocation of the first SAS/GRAPH procedure
in the SAS job. The driver will then construct a new data stream by writing
a valid GIF header and graphic data from the first procedure.
After the first SAS/GRAPH procedure has been executed, you must construct the body of the GIF animation. You can think of the Body as all the graphic images between the first and last image. Set GOPTIONS GSFMODE=APPEND to signal the GIFANIM driver to suppress the header information and to begin appending graphic data to the current data stream. The GOPTIONS GSFMODE=APPEND statement must appear somewhere between the first and second SAS/GRAPH procedures.
Note: If you use BY-group processing on the first graphics
procedure to generate multiple graphs, they are automatically appended to
the same GIF file. Thus, you do not need 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 this Body section in your program.
The final step 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 the last procedure uses BY-group processing.
'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;
After the animation is complete, issue a GOPTIONS RESET=ALL statement to prepare for succeeding SAS jobs.
GIFANIM Device Driver Controls |
You can control the GIFANIM device driver with these GOPTIONS settings:
For a complete description of these options, see Graphics Options and Device Parameters Dictionary.
Note: Beginning with Version 7, some of the options
that control the GIFANIM driver's behavior are different from earlier releases.
Changing the Size of the Output |
If the default size of the GIFANIM device is not suitable for your needs, you can modify GOPTIONS HSIZE= and VSIZE= accordingly. The following SAS macro has been provided so that you can set HSIZE= and VSIZE= indirectly in pixel units:
%macro IMGSIZE(w=1280, h=1024, dpi=100, rows=43, cols=83); %if &dpi <=0 %then %put DPI must be greater than zero.; %else %do; goptions hsize=%sysevalf(&w/&dpi)in vsize=%sysevalf(&h/&dpi)in hpos=&cols vpos=&rows %end; %mend IMGSIZE;
For example, to create an image that is 373 pixels wide and 280 pixels high, submit this macro call:
%imgsize(w=373, h=280);
Here are some key points to remember when using the %IMGSIZE macro:
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.