A quick SAS ODS Graphics annotation take on those classic wooden ABC blocks. Happy Mother's Day, all!
* Fun With SAS ODS Graphics: Happy Mother's Day Wooden Block Greetings;
data point; /* Need data to create a "dummy" scatter plot that we can annootate */
retain x y 0;
%SGANNO; /* Use SAS ODS Graphics annotate macros to create "wooden blocks" */
data rectangles; /* Create 3 ABC blocks (M-O-M) with bright-colored rounded borders/letters & light wood-color background */
%SGIMAGE (image="/home/ted.conway/babyblue.png", layer="BACK"); /* Background image of babies + moms by Reuben Saidman (commons.wikimedia.org/wiki/File:Baby_show_(3588770019).jpg) *//
%macro Block(letter, color, x=, y=); /* Macro to draw an ABC "block", specify a letter, color, origin (x,y) */
%SGRECTANGLE (height=2, width=2, x1=&x, y1=&y, fillcolor="&color", reset="ALL", cornerradius=.15, drawspace="DATAVALUE", display="fill", HEIGHTUNIT="DATA", WIDTHUNIT="DATA"); /* Color border */
%SGRECTANGLE (height=1.6, width=1.6, x1=&x, y1=&y, fillcolor="cxfff8dc", cornerradius=.15, drawspace="DATAVALUE", display="fill", HEIGHTUNIT="DATA", WIDTHUNIT="DATA"); /* Wood interior */
%SGTEXT (label="&letter", FILLTRANSPARENCY=1, x1=&x, y1=&y, textcolor="&color", border="false", textsize=96, textweight="BOLD", drawspace="DATAVALUE"); /* Color text */
%mend;
/* Stacked blocks that spell M-O-M */
%Block(M, Navy, x=-.4, y=3.6); %Block(O, Red, x=-.4, y=1.5); %Block(M, Green, x=-.4, y=-.6);
ods graphics / antialias height=6in width=6in; /* Plot the blocks! */
proc sgplot data=point aspect=1 sganno=rectangles nowall noborder pad=0; /* Dummy scatter plot + annotate dataset to draw the blocks and create background */
scatter x=x y=y / markerattrs=(size=0pt); /* Dummy plot with marker size of zero to make it invisible */
inset "HAPPY " "MOTHER'S " "DAY! " / position=right textattrs=(size=36pt weight=bold color=darkslateblue); /* Happy Mother's Day! greeting inset */
xaxis display=none min=-1.5 max=5; yaxis display=none min=-1.5 max=5; /* Limit axes bounds, suppress axes labels/lines/values */
run;
CHART (BEFORE SAS CODE TWEAKING)
BACKGROUND IMAGE (BEFORE MS-WORD DOCTORING)
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.
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.