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

fathersday.png

 

It's a bit late in the Father's Day, but here's a quick SAS ODS Graphics knockoff of Ates Evren Aydinel's neat father icon, in which I cut a few corners by not cutting the rectangle corners with ovals. 😀

 

* Fun With SAS ODS Graphics: Happy Father's Day (Polygon+Ellipse Plots)
  Inspired by and points courtesy of Ates Evren Aydinel from 'father' icon, thenounproject.com/icon/father-479841;

%macro circle(x=,y=,r=);                        * Macro to output circle data - x/y points + diameter;
cx=&x; cy=&y; d=&r; output circles; 
%mend;

%macro rectangle(points) / parmbuff;            * Macro outputs rectangle data - 4 pairs of x/y points + polygon ID + group ID;
polygon+1; group=1;                             * Increment polygon ID, group ID is constant;  
%do n=1 %to 7 %by 2;                            * Generate 4 pairs of x/y points; 
  rx=%scan(%str(&syspbuff),&n);                 * Syspbuff contains all macro parameters;
  ry=%scan(%str(&syspbuff),%eval(&n+1));
  output rectangles;
%end;
%mend;

data circles(keep=cx cy d) rectangles(keep=rx ry polygon group);
%circle(x=317, y=107, r=67);                    * Dad head;
%rectangle(271,192 363,192 363,443 271,443);    * Dad torso;
%rectangle(183,232 275,232 275,272 183,272);    * Dad arm;
%circle(x=145, y=125, r=38);                    * Child head;
%rectangle(121,175 169,175 169,310 121,310);    * Child torso;
%rectangle(165,190 216,190 216,216 165,216);    * Child arm;

data circlesrectangles; set circles rectangles; * Merge circle + rectangle data into one dataset for charting;

ods graphics / reset height=5in width=5in; 
proc sgplot data=circlesrectangles aspect=1 noborder nowall noautolegend;                          * Ellipse+Polygon plot of father holding child;
ellipseparm semimajor=d semiminor=d / xorigin=cx yorigin=cy fill fillattrs=(color=black);          * Draw circles;
polygon x=rx y=ry id=polygon / fill nooutline fillattrs=(color=black) group=group nomissinggroup;  * Draw rectangles; 
xaxis display=none min=0 max=500 offsetmax=.001 offsetmin=.001;                                    * Limit x/y axis bounds;
yaxis display=none min=0 max=500 offsetmax=.001 offsetmin=.001 reverse;
inset "HAPPY FATHER'S DAY!" / position=bottom textattrs=(size=14pt weight=bold color=black);       * Message at bottom;
run;

 

Pre-FillPre-Fill

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 0 replies
  • 711 views
  • 2 likes
  • 1 in conversation