Easy new way to send drilldown graphs in an email


In a previous post, I showed you how to send graphs with charttips & drilldowns in an email ... but what if you also need to send the graphs that you're drilling-down to?

You guessed it - SAS also has a slick trick for doing that!

When you create SAS graphs with ods html, you can place several graphs on the same html page. And if you insert html anchors between the graphs, this gives you an easy way to jump straight to that anchor via a url.

For example, if I have a bunch of state maps on the same page, and I run the following SAS code right before the South Carolina (SC) map...

ods html anchor="sc";

Then I can jump right to the SC map by specifying the html anchor (#sc) on the end of the url, such as:


You can use these kind of url/anchor links to go from one graph to another on the same page, thereby creating a self-contained drilldown graph. Here's an example if you want to give it a try (click the bars to go to the state maps), and below is the code I used to create the links to the html anchors in the bars:

htmlvar=' href='||quote('#'||trim(left(lowcase(st))));

Now, if you combine the above html anchor trick (which has been in SAS for several releases) with the new SAS 9.4 html5 trick (embedding the png files inline in the html), you can create the above example using a single html file that has the main graph and all the drilldown graphs conveniently packaged into a one file that is perfect for sending in an email!

If you've got SAS 9.4, and want to try it, here's the code!

Mailbox photo credit: slgckgc.


About Author

Robert Allison

The Graph Guy!

Robert has worked at SAS for over a quarter century, and his specialty is customizing graphs and maps - adding those little extra touches that help them answer your questions at a glance. His educational background is in Computer Science, and he holds a BS, MS, and PhD from NC State University.

Related Posts

Comments are closed.

Back to Top