Lapis Lazuli | Level 10

## Fun With SAS ODS Graphics: Square + Circles Valentine

Tired: Say It With Flowers. Wired: Say It With Geometry. 😀 Happy Valentine's Day!

``````* Fun With SAS ODS Graphics: Square + Circles Valentine;

data points;                                       * Generate points for square (polygon) and 2 circles (ellipses);
retain polygon 1;
xs=-cos(constant("pi")/4); ys=0; output;           * 1 square, sides of length 1, rotated 45 degrees;
xs=0; ys=sin(constant("pi")/4); output;
xs=cos(constant("pi")/4); ys=0; output;
xs=0; ys=-sin(constant("pi")/4); output;
xs=.; group=1;                                     * 2 circles, diameter 1, centered on top left/right sides of square;
x=-cos(constant("pi")/4)/2; y=sin(constant("pi")/4)/2; output; x=-x; output;

ods graphics / width=5in height=5in;
proc sgplot aspect=1 noautolegend nowall noborder; * Draw valentine (1 square + 2 circles);
styleattrs backcolor=lightpink;
inset "HAPPY VALENTINE'S DAY!" / position=bottom textattrs=(color=cxC00000 weight=bold size=18pt);
polygon x=xs y=ys id=polygon / fill fillattrs=(color=cxC00000) transparency=.0 outline
lineattrs=(color=cxC00000 thickness=3pt) transparency=.5;
ellipseparm semimajor=.5 semiminor=.5 / xorigin=x yorigin=y group=group nomissinggroup
outline lineattrs=(color=cxC00000 thickness=3pt) xorigin=x yorigin=y
fill fillattrs=(color=cxC00000) transparency=.5;
xaxis display=none values=(-.9 .9);
yaxis display=none values=(-.9 .9);
run;``````