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

Happy Thanksgiving!Happy Thanksgiving!

 

Thanksgiving week is upon us, so here's a quick SAS ODS Graphics waffle chart (aka isotype chart, aka pictogram, aka scatter plot!) to display the factoid that 88% of Americans reportedly plan to feast on turkey this holiday season. For another SAS ODS Graphics take on waffle charts, check out Abhinav Srivastva's PhUSE US Connect 2021 paper, Waffle Chart in SAS. Happy Thanksgiving, all!

 

* Fun With SAS ODS Graphics: Thanksgiving Turkey Waffle Chart
  Turkey factoid found at: finder.com/american-thanksgiving-turkey-spend;

data turkeys;                                                       * Generate 100 points for turkey images(100%);
do p=1 to 100;
  x=floor((p-1)/10);                                                * Fill columns from left to right, rows from bottom to top - (0,0) to (9,9);
  y=mod(p-1,10);                                                    * Assign category - turkey (88%) or no turkey;
  if p<=88 then Dinner='Turkey   '; else Dinner='No Turkey';
  output;
end;

data myattrmap;                                                     * Create attribute map to assign images to categories; 
id="myid"; value='Turkey   '; markersymbol='turkey  '; output;
id="myid"; value='No Turkey'; markersymbol='noturkey'; output;                                          
                                                                    * Generate 'waffle' chart of turkey images (scatter plot of images);
proc sgplot data=turkeys noborder dattrmap=myattrmap nowall noautolegend pad=(top=4pt left=.25in right=.25in bottom=0pt);
styleattrs backcolor=cxFBFBD5;                                      * Light goldenrod yellow background, 'seal brown' text & images; 
inset ' 88% of Americans Plan on Turkey for Thanksgiving ' / textattrs=(size=15.5pt color=cx623004 weight=bold) position=top;
symbolimage name=turkey image='/home/ted.conway/turkey3.png';       * Filled turkey (Office365 turkey icon);
symbolimage name=noturkey image='/home/ted.conway/noturkey3.png';   * Turkey outline (Office365 turkey icon);
scatter x=x y=y / attrid=myid markerattrs=(size=32pt) group=dinner; * Scatter plot w/custom legend;
keylegend 'turkey' 'noturkey' / noborder noopaque position=bottom location=inside;
legenditem type=marker name='turkey'  / markerattrs=(symbol=turkey size=22pt) label='Turkey' labelattrs=(size=12pt weight=bold color=cx623004);
legenditem type=marker name='noturkey' / markerattrs=(symbol=noturkey size=22pt) label='No Turkey' labelattrs=(size=12pt weight=bold color=cx623004);
xaxis display=none; yaxis display=none offsetmin=.13 offsetmax=.13; * Suppress axes, add padding;

 

TURKEYS (Office365 Turkey Icons)

TurkeyTurkeyNo TurkeyNo Turkey

 

BLACK & WHITE

Look Ma, No Color!Look Ma, No Color!

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 702 views
  • 6 likes
  • 1 in conversation