Click here to see the SAS code.
Click here to see the example.


The drilldown in this example is done in the traditional SAS/Graph way,
but in the annotate dataset rather than in the bar/response data
as was shown in a previous example (using annotate is a little 
trickier, but the syntax for the html charttip & drilldown is 
basically the same, except the variable *must* be named 'html') ...

First, a character variable is created in the annotate dataset, 
containing the html tags for the drilldown (href=) and the text 
charttip/rollover-text (title=) as follows -- this particular
annotate example annotates the text value of the full-name of
the state onto the end of each bar ...

   data myanno; set mydata;
   length html $500 text $20;
   xsys='2'; ysys='2'; when='a';
   function='label'; position='4';
     'State: '|| trim(left(st)) ||'0D'x||
     'Population: '|| trim(left(put(population,comma12.0))))||
    ' href="http://www.state.'||trim(left(lowcase(st)))||'.us"';

Then, when that annotate is used by a sas/graph proc, it automatically
uses the 'html' variable as a charttip & drilldown.

   proc gchart data=mydata anno=myanno;
   hbar st / type=sum sumvar=population ascending nostats
    maxis=axis1 raxis=axis2
    autoref cref=gray clipref
    des='' name="&name";

And the output is created using ODS HTML, and "goptions device=png",
so that a png file is created containing the png, and an html file 
is created containing the html charttips & drilldowns.  The user will
view the html file, and it will display the png image.

Back to Samples Index