BookmarkSubscribeRSS Feed
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

GIF Xmas Tree, GIF Xmas Tree...GIF Xmas Tree, GIF Xmas Tree...


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;
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;   
  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;
proc template;                                                           * Define chart;
define statgraph xmas;
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;

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;

options printerpath=gif animation=stop; * Animated GIF wrapup;
ods printer close;



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 1 in conversation