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

MomColor.png

 

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)

MomBW.png

 

BACKGROUND IMAGE (BEFORE MS-WORD DOCTORING)

Baby_show_(3588770019).jpg

Source: Wikimedia Commons, Reuben Saidman

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 682 views
  • 4 likes
  • 1 in conversation