Click here to see the SAS code.
Click here to see the example.
---------------------------------------------------------------
Note that anchor drilldown is included in the book SAS/Graph: Beyond the Basics,
and all the 'tricks' used to create it are described in great detail!
(see Example 19)
---------------------------------------------------------------
The drilldown in this example is done in the traditional SAS/Graph way,
with a little extra "twist" in that the drilldowns are to html
"anchors" on to additional graphs on the same page as the top-level
graph.
First, a character variable is created, containing the html tags for
the drilldown (href=) and the text charttip/rollover-text (title=)
as follows - notice the '#' is used to denote the url is an 'anchor' ...
htmlvar=
'title='||quote(
'State: '||trim(left(st))||'0D'x||
'Population: '||trim(left(put(population,comma12.0))))||
' href="#'||trim(left(lowcase(st)))||'"';
Then that variable is specified using the "html=" option in the
SAS/Graph "proc gchart" as follows...
proc gchart data=mydata;
hbar st / type=sum sumvar=population ascending nostats
maxis=axis1 raxis=axis2
autoref cref=gray clipref
coutline=black
html=htmlvar <-------- here!
des='' name="&name" ;
run;
That was for the first/top-level graph.
For the additional graphs, you need to "append" them to the same page,
and use the "ods html" anchor option to output an 'anchor' ...
%let state=va;
ods html anchor="&state";
title "&state";
proc gmap data=mydata map=maps.us (where=(state = stfips("&state")));
id state;
choro state / levels=1 coutline=black nolegend
html=htmlvar2
des='' name="&name._&state";
run;
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