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

1 REPLY 1
Techle
Calcite | Level 5

Fun With SAS ODS Graphics: Happy Mother's Day Wooden Block Greetings demonstrates how SAS ODS Graphics can be used to create visually appealing and personalized greeting designs using data visualization techniques. By combining graphics, text, and creative formatting, users can generate a unique Mother's Day greeting featuring wooden block-style elements. This example highlights the flexibility of SAS ODS Graphics in producing custom designs and showcases how SAS can be used beyond traditional data analysis to create engaging visual content.

Wooden Cottages

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 1 reply
  • 1753 views
  • 6 likes
  • 2 in conversation