Hopefully you know that a gif animation can be used for more than just showing a cartoon animal doing cute tricks! Being a savvy data-meister, I'm sure you are also aware that you can use gif animations to see how data changes over time.
But perhaps you didn't know you could use SAS/GRAPH to create gif animations? Or perhaps you weren't sure of the exact code to use? Hopefully this blog will pique your interest, and this example code will help you start creating your own gif animations!
Recently, Gordon Keener (one of the SAS R&D legends) gave me a graph challenge. Researchers from UCLA had developed a technique for tracking the paths of individual stars -- their research is helping prove the existence of a black hole near the center of the Milky Way galaxy. Gordon sent me a link to their raw data, and asked if I could graph it (i.e., he "threw down the gauntlet") ... how could I resist?!? :-)
Here is the graph I came up with - a 3d gif animation. Notice that the orbits of the stars look very similar to the orbits of planets around the Sun, moving faster as they get closer to the black hole.
How do you create similar gif animations in SAS?
My SAS code reads the raw data directly from the web (without having to save it to my hard drive ... which is in and of itself pretty cool, IMHO!) and then plots it using proc G3D. I use a 'by' statement, and each 'by group' produces 1 frame in the gif animation.
One difference from creating traditional SAS/GRAPHs is using 'put' statements to script out some html header code, and then set the goptions to control the gif animation -- in particular the 'delay' between frames, and the 'iteration' which controls how many times the animation repeats.
A trick I had to use with this particular graph is that I add some 'fake' data to represent the maximum extents of the desired axes (so G3D will always pick the same auto-scaled axes). I also insert a reference point at (0,0,0) and have it plot with a cross-shaped marker to represent the 3D origin (which is also the hypothetical location of the black hole).