Adding Harvey Balls to your SAS reports

7

I'm currently working on a large project for a SAS customer. The project comprises many activities and phases, so there is a need to track progress on many different levels. During a recent meeting the project manager announced, "I'm putting together a status deck, and I'll include some Harvey Balls for each item."

"Harvey whats?" I said, nearly spitting out my coffee.

I've since learned that Harvey Balls are a project-management thing. They are used as way to communicate qualitative progress towards a goal: not just whether an item is complete, but also how far along it is. (Please, don't confuse these with Harvey wallbangers, which are used to measure progress towards something else.) Harvey Balls remind me of the little circles that I see in Consumer Reports product reviews.

A web search will yield lots of examples of how to add Harvey Balls to your PowerPoint slides and Excel spreadsheets -- favorite domains of project managers. However, there isn't much (any?) about how to use these in SAS, so with this blog post I hope to corner the market.

First, a visual -- here's what Harvey Balls look like in a SAS report:

hbreport
It turns out that the Harvey Ball glyphs are built into some of the fonts that you probably have installed, and can be accessed by referencing their Unicode character values. For ODS-based reports, we can include any Unicode character that we need by using:

  • the ODS escape character, combined WITH...
  • the {unicode} keyword, AND..
  • the hexadecimal code of the character we want.

For example:

ods escapechar='~';
title "This is a full-circle Harvey Ball: ~{unicode '25CF'x}";

yields this:

hbtitle
For a more data-driven approach, I decided to encode the Harvey Balls in a numeric SAS format. In my mapping, I set values between 0 and 4, inclusive. 0 means "empty" or no progress, whereas 4 means "full" or complete. 1 through 3 represent a quarter, halfway, and three-quarters, respectively.

ods escapechar='~';
proc format lib=work;
value hb  
  0 = "~{unicode '25CB'x}" /* empty circle */
  1 = "~{unicode '25D4'x}" /* quarter */
  2 = "~{unicode '25D1'x}" /* half */
  3 = "~{unicode '25D5'x}" /* three-quarter */
  4 = "~{unicode '25CF'x}" /* full */
;

Here's a partial listing of the PROC REPORT code that uses the format. Note that I added some other appearance treatments to the report column with the Harvey Ball. Because the font glyph tends to be small, I bumped up the font size to 18 points. I also specified Lucida Sans Unicode as the font face because I know that font contains the right glyphs. Finally, I tweaked the alignments to account for the larger padding that accompanies the larger font size, ensuring the data looked vertically aligned properly in each row.

proc report data=progress;
 columns  stage dev test prod;
 define stage / 'Activity' display style=[verticalalign=center];
 define dev  / '% Dev' format=hb.
  style(column)=[
   font_face='Lucida Sans Unicode' 
   font_size=18pt 
   verticalalign=center 
   just=c 
   color=blue
   ];
/* ... */

>> Download the complete example program from here. (Should work with SAS 9.2 or later)

Bonus: If you have SAS 9.4, you can modify this program to place the report directly into PowerPoint! This makes it perfect for consumption by project managers everywhere.

ods powerpoint file="c:\temp\hb.pptx" style=PowerPointLight;
/* proc report section here...*/
ods powerpoint close;

Here's a screenshot of the result (click to see it full size):

hbppt

See also

The Power of Unicode (using these characters in SG plots)
Unicode Tick Values using GTL
The Great Escape(char) - great paper by SAS user Louise S. Hadden

Share

About Author

Chris Hemedinger

Senior Manager, SAS Online Communities

+Chris Hemedinger is the manager of SAS Online Communities. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies.  He also hosts the SAS Tech Talk webcasts each year from SAS Global Forum, connecting viewers with smart people from SAS R&D and the impressive work that they do.

7 Comments

    • Chris Hemedinger
      Chris Hemedinger on

      Thanks Dino -- hopefully you've learned your lesson about mixing project management with cocktails.

  1. Pingback: Add a stars-style rating column to your SAS output - The SAS Dummy

  2. Hi,
    The size of the circle is the same in the default HTML destination.
    But, when using Powerpoint or Excel the empty circle and the disk are smaller than the other ones.
    In other words, the font "Lucida Sans Unicode" is not take into account. It is converted to "Courier".

    I've tried with those other font but it didn't help:
    *MYingHei_18030_C-Medium;
    *Segoe UI Emoji;
    *Segoe UI Symbol;
    *SimSun;
    *Symbola;

    I'm using Microsoft Office 365.

    Kind Regards,
    Véro

    • Chris Hemedinger
      Chris Hemedinger on

      The example works for me and font sizes are as expected for all symbols, but here are some ideas.

      First, when using PPT or Excel, make sure that there are no other ODS destinations open. The styles/options set by one ODS destination may influence what you see in others. In EG you might have SAS Report or HTML on by default, and in SAS Studio you have HTML5 by default. Here's an article about how to control this in EG.

      Next, when specifying a font in code for Windows, the font name needs to be exact. Check the font names in your Windows Font directory.

Leave A Reply

Back to Top