A quick 2020 SAS ODS Graphics take on a neat 2016 Christmas card by Designjunction. Happy Holidays!
* Fun w/SAS ODS Graphics: GIF Xmas Tree, GIF Xmas Tree...
An ODS Graphics take on a 2016 Xmas card by Designjunction at dezeen.com/2016/12/24/designer-christmas-cards-2016;
data tree;
do frame=0 to .95 by .05; * Create 20 frames of scrolling bars (GIF will repeat);
px=-10; py=16.5; output; px=10;py=-2.5; output; px=.;py=.; * Set upper left, lower right bounds of data;
do p=14.5 to .5 by -1; * White diagonal bars;
id+1; y=p; x=-5; output; y=y-.3; x=5; output; y=y-.5; output; y=p-.5; x=-5; output;
end;
id=.; x=.; y=.;
do p=(16.5-frame) to (-.5-frame) by -1; * Red horizontal bars;
sid+1; sy=p; sx=-8; output; sx=8; output; sy=p-.5; output; sx=-8; output;
end;
end;
proc template; * Define chart;
define statgraph xmas;
begingraph;
layout overlayequated / xaxisopts=(offsetmin=0.001 offsetmax=0.001 display=none)
yaxisopts=(offsetmin=0.001 offsetmax=0.001 display=none) walldisplay=none;
scatterplot x=px y=py / markerattrs=(size=0); * "Dummy" plot - set up chart bounds;
beginpolygon x=0 y=15 / drawspace=datavalue display=(fill) fillAttrs=(color=green) layer=back;
draw x=5 y=0; draw x=-5 y=0; endpolygon; * Draw static Xmas tree (triangle);
polygonplot x=x y=y id=id / display=(fill) fillattrs=(color=white); * Draw static white diagonals thru tree;
polygonplot x=sx y=sy id=sid / display=(fill) fillattrs=(color=red); * Draw moving horizonatl slits;
beginpolygon x=-8 y=16 / drawspace=datavalue display=(fill) fillAttrs=(color=white) layer=front;
draw x=8 y=16; draw x=8 y=17; draw x=-8 y=17; endpolygon; * Mask off top of card (for "infinite scroll" of red bars);
beginpolygon x=-8 y=-1 / drawspace=datavalue display=(fill) fillAttrs=(color=white) layer=front;
draw x=8 y=-1; draw x=8 y=-2; draw x=-8 y=-2; endpolygon; * Mask off bottom of card (for "infinite scroll" of red bars);
entry textattrs=(size=14pt weight=bold color=green) "HAPPY HOLIDAYS!"/ valign=bottom;
endlayout;
endgraph;
end;
run;
ods _all_ close; * Animated GIF setup;
options papersize=('6 in', '6 in') printerpath=gif animation=start
nodate nonumber animloop=YES NOANIMOVERLAY animduration=.09;
ods printer file='/folders/myfolders/xmas2020.gif';
ods graphics on / reset antialias width=6in height=6in imagefmt=GIF;
options nobyline;
proc sgrender data=tree template=xmas; * Generate Xmas card!;
by frame;
run;
options printerpath=gif animation=stop; * Animated GIF wrapup;
ods printer close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.