Sample 25247: Use the GIF device driver with the ODS HTML statement to create a graph for the Web that has mouseover data tips and drill-down capability
This sample code produces a graph for the Web with data tips and drill-down capabilities using the GIF device driver. Once the resulting graph displays in your Web browser, hover your mouse over a bar in the graph to display data tip information. Click on a bar in the graph to drill down to a detailed report for that bar.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample code writes its output to the C:\TEMP directory when run on the Windows operating system. Modify the value for the PATH= option in the ODS HTML statement below if you want to write the output to a location other than C:\TEMP or if you are running on an operating
system other than Windows.
/* Create the data set REGSALES. */
data regsales;
length Region State $ 8 rpt $300;
format Sales dollar8.;
input Region State Sales;
/* Add a variable to the data set that will be used with the */
/* HTML= option on the VBAR3D statement of GCHART. Set the */
/* length of this variable large enough to hold all of the */
/* data tip and drill down information. */
length rpt $ 300;
/* Assign values to the TEXT variable by REGION. In this case, the text */
/* will be the names of the different states within the region. */
if Region = 'Central' then text="Illinois, Indiana, Ohio, Michigan";
else if Region = 'South' then text ="Florida, Georgia";
else if Region = 'West' then text="California, Oregon, Washington";
/* Create the RPT variable for each REGION using a combination */
/* of TITLE= and HREF=. */
rpt='TITLE="' || trim(text) || '" HREF="' || trim(region) || '.html"';
/* Data lines */
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
;
run;
/* Set the graphics environment */
goptions reset=all cback=white border
htitle=12pt htext=10pt;
goptions device=gif gsfname=grafout gsfmode=replace
xpixels=600 ypixels=400;
ods listing close;
ods html path='c:\temp' (url=none) body='g25247.html';
title1 h=12pt 'Hover your mouse over a bar for data tip information';
title2 h=12pt 'Click on a bar to drill down to a detailed report';
axis1 minor=none label=(angle=90 'Sales');
proc gchart data=regsales;
vbar region / sumvar=sales patternid=midpoint html=rpt raxis=axis1;
run;
quit;
ods html close;
/* Open a body file for report on Central sales. */
ods html path='c:\temp' (url=none) body='Central.html';
title1 'Central Sales';
proc print data=regsales noobs;
var state sales;
where region='Central';
run;
ods html close;
/* Open a body file for report on Southern sales. */
ods html path='c:\temp' (url=none) body = 'South.html';
title1 'Southern Sales';
proc print data=regsales noobs;
var state sales;
where region='South';
run;
ods html close;
/* Open a body file for report on Western sales. */
ods html path='c:\temp' (url=none) body = 'West.html';
title1 'Western Sales';
proc print data=regsales noobs;
var state sales;
where region='West';
run;
quit;
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample produces a graph with data tips and drill-down capabilities using the GIF device driver.
Type: | Sample |
Topic: | Third Party ==> Output ==> Device Drivers ==> GIF, JPEG, PNG SAS Reference ==> ODS (Output Delivery System)
|
Date Modified: | 2011-09-22 10:22:50 |
Date Created: | 2005-03-04 13:01:26 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | n/a | n/a |