Here is an example
that demonstrates the URL drill-down mode. This example is available
in the SAS sample library under the name GWBURLDR. For further information,
see Links in JAVA Presentations. This example generates a drill-down bar chart of regional
sales data as shown in the following figure.
Clicking on any one
of the bars in the bar chart opens the corresponding HTML file that
displays a table further breaking down the sales data. To create the
drill-down chart, a link information variable, RPT, is added to the
data set to contain the HREF=
url and
the TITLE=
tool-tip-text attributes
for each region bar in the chart. ODS inserts these attributes into
the image map for the graph when it generates the HTML output. Because
the RPT variable includes the HREF= and TITLE= attributes, the HTML=
option must be used in the GPLOT statement to specify the RPT variable.
The URL= option cannot be used in this case.
Here is the example
program code.
/* Change web-output-path in the following macro variable
definition to a valid output path. */
%let outpath=web-output-path;
/* Define the output directory and file references */
filename urldrill "&outpath"; /* Path to the output files */
filename sales "&outpath/sales.html";
filename central "&outpath/central.html";
filename south "&outpath/south.html";
filename west "&outpath/west.html";
/* Close the current ODS HTML destination. */
ods html close;
/* Specify the device. */
goptions reset=all device=java;
/* Create the data set REGSALES. */
data regsales;
length Region State $ 8;
format Sales dollar8.;
input Region State Sales;
/* Initialize the link variable. */
length rpt $150;
/* Assign values to the HTML variable. */
if Region="Central" then
rpt='href="central.html" title="Click to see Central sales data"';
else if Region="South" then
rpt='href="south.html" title="Click to see Southern sales data"';
else if Region="West" then
rpt='href="west.html" title="Click to see Western sales data"';
datalines;
West CA 13636
West OR 18988
West WA 14523
Central IL 18038
Central IN 13611
Central OH 11084
Central MI 19660
South FL 14541
South GA 19022
;
/* Open the HTML output file and specify the URL drill-down mode. */
ods html body=sales
path=urldrill
style=money
parameters=("drilldownmode"="url");
/* Create a chart that uses the link variable. */
title "Company Sales";
proc gchart data=regsales;
vbar3d region / sumvar=sales
patternid=midpoint
html=rpt; /* Set the HTML variable to rpt */
run;
quit;
/* Create an HTML file for Central sales. */
ods html body=central path=urldrill style=money;
title "Central Sales";
proc print data=regsales noobs;
var state sales;
where region="Central";
run;
/* Create an HTML file for Southern sales */
ods html body=south path=urldrill style=money;
title "Southern Sales";
proc print data=regsales noobs;
var state sales;
where region="South";
run;
/* Create an HTML file for Western sales. */
ods html body=west path=urldrill style=money;
title1 "Western Sales";
proc print data=regsales noobs;
var state sales;
where region="West";
run;
quit;
/* Close ODS HTML to close the output file, and then reopen ODS HTML. */
ods html close;
ods html;