Out of the bosom of the Air,
Out of the cloud-folds of her garments shaken,
Over the woodlands brown and bare,
Over the harvest-fields forsaken,
Silent, and soft, and slow
Descends the snow.
"Snow-flakes" by Henry Wadsworth Longfellow
Happy holidays to all my readers! In my last post I showed how to create a well-known fractal called the Koch snowflake. The snowflake is aptly named because it has six-fold symmetry. But as Longfellow noted, a real snowflake is not stationary, but descends "silent, and soft, and slow."
As a gift to my readers, I decided to create an animated greeting card entirely in SAS. The animated GIF (click to enlarge) uses some of the SAS techniques that I have blogged about in 2016. The falling and rotating snowflakes were created by using matrix computations in the SAS/IML language. The animated GIF was created by using ODS graphics and PROC SGPLOT.Create an animated greeting card with #SAS Click To Tweet
Techniques used to create the animation
If you want to learn how I created this animated GIF with SAS, read on. I've blogged about all the essential techniques in previous posts:
- Create a Koch snowflake by using SAS/IML software.
- Create the centers of the snowflake by using uniform spacing with random perturbations.
- Use matrix operations to rotate and scale the snowflakes. Use vector operations to translate the snowflakes.
- Use the POLYGON statement in PROC SGPLOT to plot the snowflakes for each frame. For the fill color, I chose an off-white color that has the name "snow." The flakes are semi-transparent so that the text is not obscured.
- Use the TEXT statement in PROC SGPLOT to display the holiday greeting.
- To suppress the axes labels, tick marks, and values, use the DISPLAY=NONE option on the XAXIS and YAXIS statements in PROC SGPLOT.
- Create the animation automatically by using the BY statement in PROC SGPLOT. Prior to calling PROC SGPLOT, you have to set up ODS so that the output is written to an animated GIF file.
You can download the SAS program that creates the greeting card. Let me know if you adapt this program to create other animated images.
If you like SAS statistical programming or want to learn more about it, subscribe to this blog. In most articles I show how to use SAS for serious pursuits like statistical modeling, data analysis, optimization, and more. But programming with SAS can also be fun, and sometimes it takes a less-serious application to make people say, "Wow! That's cool! I didn't know SAS could do that!"