O'Reilly logo

SAS/GRAPH: Beyond the Basics by Robert Allison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required