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

peeps.gif

 

Happy Easter, SAS Peeps!

 

BUILT-FROM-ELLIPSES EASTER BUNNY - BEFORE FILL

 

peepstatic.gif

 

SAS CODE

 

* Fun w/SAS ODS Graphics: Built-From-Ellipses Easter Bunnies;

%macro bunny();

ods _all_ close; * Animated GIF setup (pause for 2 secs on 1st frame);                       
options papersize=('5 in', '5 in') printerpath=gif animation=start nodate nonumber animduration=2 animloop=YES NOANIMOVERLAY;
ods printer file='/folders/myfolders/peeps.gif' ; * Animated GIF image filename;
ods graphics / height=5in width=5in imagefmt=gif antialias; 

%do f=1 %to 21; * Generate 21 "frames" (Easter Bunnies) for animated GIF; 

%let title=%substr(%str( HAPPY EASTER, PEEPS!),1,&f); * Title (one letter at a time);
%if &f=1 %then
  %let title=HAPPY EASTER, PEEPS!;; * Full title on first frame;
%let letter=%substr(%str( HAPPY EASTER, PEEPS!),&f,1); * New letter in title;

/* Lifewire: The Colors of Easter https://www.lifewire.com/the-colors-of-easter-4126619  
   Light Plum, Sky Blue, Turquoise, Lemon, Spring Green, Mint, Pale Pink, Light Salmon, Violet, Lilac, Robin's Egg Blue, Lavender */
%let color=CX%scan(%str(dda0dd,87ceeb,40e0D0,fff700,00ff7f,bdfcc9,ffc0cb,ffa07a,ee82ee,c8a2c8,00cccc,b573dc,dda0dd,87ceeb,40e0D0,fff700,00ff7f,bdfcc9,ffc0cb,ffa07a,00ff7f),&f,",");

data peeps; * Generate point for text plot to show each new letter in title;
x=220; y=640; label="&letter";

proc template; * Draw built=from-ellipses Easter Bunny (using points obtained via MS-Paintbrush grid);
define statgraph ellipseparm;
begingraph / opaque=true border=false backgroundcolor=WHITE; * Smoke white background;
  entrytitle "&title";
  layout overlayequated / opaque=true border=false backgroundcolor=WHITE wallcolor=WHITE WALLDISPLAY=(FILL)
    xaxisopts=(display=none offsetmin=0.05 offsetmax=0.05)
    yaxisopts=(display=none offsetmin=0.05 offsetmax=0.05 reverse=true); * y-values lower at top in Paintbrush, so reverse;
    ellipseparm xorigin=220 yorigin=640 semimajor=220 semiminor=220 slope=0 /
                fillattrs=(color=&color.) display=(fill); * Body (semimajor=semiminor=circle);
    ellipseparm xorigin=220 yorigin=397 semimajor=185 semiminor=120 slope=0 /
                fillattrs=(color=&color.) display=(fill); * Head;  
    ellipseparm xorigin=130 yorigin=148 semimajor=85 semiminor=210 slope=-.4 /
                fillattrs=(color=&color.) display=(fill); * Left Ear (use -slope to tilt left);  
    ellipseparm xorigin=310 yorigin=148 semimajor=85 semiminor=210 slope=.4 /
                fillattrs=(color=&color.) display=(fill); * Right Ear (use +slope to tilt right);  
    ellipseparm xorigin=220 yorigin=430 semimajor=15 semiminor=15 slope=0 /
                fillattrs=(color=black) display=(fill); * Nose;  
    ellipseparm xorigin=155 yorigin=392 semimajor=15 semiminor=15 slope=0 /
                fillattrs=(color=black) display=(fill); * Left Eye;  
    ellipseparm xorigin=285 yorigin=392 semimajor=15 semiminor=15 slope=0 /
                fillattrs=(color=black) display=(fill); * Right Eye;
    textplot x=X y=y text=label / position=center strip=true
             textattrs=(color=white size=60pt weight=bold); * Display new letter of message;
   endlayout;
  endGraph;
 end;
run;
proc sgrender data=peeps template=ellipseparm;
run;
options animduration=.6;
%end;
options printerpath=gif animation=stop; * Animated GIF wrap-up;
ods printer close;
%mend;

%bunny; * Draw Bunnies!;

GETTING ELLIPSE POINT COORDINATES WITH PAINT

To get the rough coordinates of the points needed for the ellipses, I just cut-and-pasted a picture of a 'Peeps' cereal box into Microsoft Paintbrush and hovered over the pertinent points to display the coordinates in the status bar.

 

PeepPaint.jpg

 

1 REPLY 1
MichelleHomes
Meteorite | Level 14

You are a dataviz whiz!!! I LOVE seeing your creativity and SAS skills with each Fun with SAS ODS Graphics post.

 

Have a lovely Easter.

 

Cheers,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1719 views
  • 11 likes
  • 2 in conversation