Maps Online >Resources SAS logo
Feedback   

Sample Data
Sample Programs
Tools
Useful Links

/*******************************************************************\
| Copyright (C) 2003 by SAS Institute Inc., Cary, NC, USA.          |
|                                                                   |
| SAS (R) is a registered trademark of SAS Institute Inc.           |
|                                                                   |
| SAS Institute does not assume responsibility for the accuracy of  |
| any material presented in this file.                              |
\*******************************************************************/

/* Using ODS HTML to allow "alt=" chart tips */

/********************************************************************
* This SAS program uses ODS to generate a map with chart tips like *
* the maps at www.sas.com/mapsonline. This program also expects     *
* SAS/Graph map datasets to be installed at your site and          *
* referenced by the libref MAPS.                                   *
********************************************************************/

/********************************************************************
* change this "path to a location in your file system" to an       *
* actual path.   This is the only line you have to change to run   *
* the program.                                                     *
********************************************************************/

%let path=path to a location in your file system;

/* assigns the alias ‘fileout’ to the output file.  */
filename fileout "afghanmap.html";

/* close the listing destination */
ods listing close;

/******************************************************************
* PATH= specifies the destination for all HTML and GIF files.    *
*      produced by this application.                             *
* FILE= specifies the HTML file that contains the map output.    *
******************************************************************/
ods html file=fileout (title="AFGHANISTAN Map")
path="&path" (url=none) style=mapstyle
nogtitle nogfootnote;

/* ignore previous titles. Set the graph pattern and color */
title;
pattern1 v=s c=cxFFFF99  ;

/*******************************************************************
* this datastep adds a url for each name if one exists or an alt= *
* value.                                                          *
*******************************************************************/
data ids;
length url $ 80;
set maps.AFGHANI2 ;
url = 'alt="' || trim( IDNAME ) || '" title="' || trim( IDNAME ) || '"';
run;

/* create the map using the GMAP procedure. */
proc gmap data=ids map=MAPS.AFGHANIS;
id id;
choro id / nolegend name="AFGHANIS" levels=1 coutline=black html=url;
run;
quit;

/* Close the HTML destination. */
ods html close;

/* Open the listing destination. */
ods listing;

/********************************************************************
* For more information and examples relating to the ODS statement.          *
********************************************************************/