Sample 23176: Create a map for the web using PROC GMAP that has both a mouse-over chart tip and drill-down functionality
This sample program uses the HTML option on the CHORO statement in the GMAP procedure to create a graph with a mouse-over chart tip and drill-down functionality.
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 program uses the HTML option on the CHORO statement in the GMAP procedure to create a graph with a mouse-over chart tip and drill-down functionality using the PNG device driver. In order to run this sample program, you must modify the FILENAME statement at the beginning of the code to specify the directory location where your HTML and PNG files will be written.
filename odsout 'directory location';
data maptips;
length htmlvar $100.;
set maps.us;
/* Create the drill-down information */
drillvar='href="http://www.state.'|| trim(left(lowcase(fipstate(state))))||'.us"';
/* Create chart tips that display when you hover over a state. */
/* The 'OD'x hex value creates a line break in the text string. */
altvar = 'TITLE="State code: ' || trim(left(state)) || '0D'x ||
'State name: ' || trim(left(fipnamel(state))) || '"';
/* Combine the chart tip and drill-down values into one variable */
htmlvar = trim(drillvar) || ' ' || altvar;
run;
ods _ALL_ close;
/* Specify the path and filename for the HTML file */
ods html path=odsout file='maptips.html';
/* Reset the GOPTIONS to their default values and */
/* set the device driver to PNG. */
goptions reset=all device=PNG;
title1 h=1.5 'Hover your mouse over a state for more information';
title2 h=1.5 'Click on a state to drill-down';
pattern1 v=s r=100;
/* Specify the HTML option on the CHORO statement to enable */
/* mouse-over tip and drill-down capability */
proc gmap data=maptips map=maps.us;
choro state / discrete nolegend coutline=black html=htmlvar;
id state;
run;
quit;
/* Close the HTML file and reopen the default listing destination */
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.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GMAP
|
Date Modified: | 2020-06-05 12:44:47 |
Date Created: | 2003-02-20 10:27:06 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | n/a | |