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

MonsterCard.png

 

It's Halloween week, so here's a quick SAS ODS Graphics take on a cute Halloween Card craft project for kids. Happy Trick-or-Treating, all!

 

* Fun With SAS ODS Graphics: Monster Mash (Band + Polygon + Ellipseparm Plots Mashup)
  Inspired by Halloween card at thebestideasforkids.com/handmade-halloween-cards/
  Note: Used MS-Paint to get x/y points and RGB hex colors;
  
data zigzag;                                                    /* x/y points making up monster's hair */
input xZ yZ @@; output;
datalines;
0 67  35 112  105 45  171 112  242 40  316 112  378 49  434 112  460 90
;
data rectangles;                                                /* x/y points making up monster's eyebrow and mouth */
input xR yR @@; polygon=floor((_n_-1)/4)+1; output;
datalines;
74 184  363 108  377 160  88 240  158 240  389 285  379 341  144 295
;
data circles;                                                   /* x/y points making up monster's eyeballs and pupils */
input xC yC r @@; color=mod(_n_,2);                             /* Alternate colors - white for eyeballs, black for pupils */
datalines;
210 192 24  213 191 14  261 184 24  265 184 14 
;
data combined; set zigzag rectangles circles;                   /* Mashup all of the Monster's points */

ods graphics / reset height=3.7in width=4.58in noborder;
proc sgplot data=combined nowall pad=0 noautolegend noborder;   /* Monster mash - band, polygon, ellipseparm plots */
styleattrs backcolor=cxA7DC8A datacolors=(white cx28272D);      /* Colors - green skin, black & white eyes */
band x=xZ lower=0 upper=yZ / fill fillattrs=(color=cx635A5D);   /* Monster's hair (off-black band chart) */
polygon x=xR y=yR id=polygon / fill fillattrs=(color=cx464040); /* Monster's off-black eyebrow and mouth */
ellipseparm semimajor=r semiminor=r / xorigin=xC yorigin=yC     /* Monster's eyeballs/pupils */
            slope=0 fill outline group=color nomissinggroup lineattrs=(color=black thickness=1pt);
yaxis display=none offsetmin=0 offsetmax=0 reverse values=(0 370);
xaxis display=none offsetmin=0 offsetmax=0 values=(0 458);
run;

 

Work-in-ProgressWork-in-Progress

 

 

 

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 991 views
  • 8 likes
  • 1 in conversation