EXAMPLE 21  GIF Animation

Purpose: This example demonstrates a very powerful, yet little-known feature of SAS/GRAPH: animation.

If you want to plot some trigonometric functions, there is nothing really difficult about doing that. First, you could write a DATA step to loop through the desired angles, and calculate the value of the function or functions at each angle. For example, the following code loops from 0 to 720 degrees, and calculates the sine and cosine for each angle.

data mydata;
length id $10;
do Angle = 0 to 720 by 15;
  radians=Angle*(atan(1)/45);
  Value=sin(radians); id='Sine'; output;
  Value=cos(radians); id='Cosine'; output;
  end;
run;

And then you could use PROC GPLOT to plot the values.

symbol1 color=cx66CD00 v=triangle ...

Get SAS/GRAPH: Beyond the Basics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.