Sample 25499: Labeling cities on a map using PROC GMAP
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 1, Chapter 10.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GANCITY |
| TITLE: GANCITY-Labeling Cities on a Map |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS ANNOTATE PATTERN GMAP |
| PROCS: GMAP |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
| MISC: EDIT AND UNCOMMENT THE LIBNAME STATEMENT |
| IF THE LIBREF HAS NOT BEEN DEFINED. |
+-------------------------------------------------------------+*/
/* Define the libref maps */
*libname maps 'SAS-MAPS-library';
/* Set the graphics environment */
goptions reset=all gunit=pct border cback=white
colors=(black blue green red)
ftext=swissb htitle=6 htext=3;
/* Subset US data set */
data lower48;
set maps.us;
if state ne stfips('AK');
if state ne stfips('HI');
run;
/* Create the Annotate data set, CITYSTAR */
data citystar;
length function style color $ 8 position $ 1
text $ 20;
retain xsys ysys '2' hsys '3'
when 'a';
set maps.uscity(keep=x y city state);
if (city='Atlanta' and state=13)
or city='Chicago' or
city='Seattle';
/* Create the observation for a star */
function='symbol'; style='marker'; text='V';
color='red'; size=5; output;
/* Create the observation for a city */
function='label'; style='swissb'; text=city;
color='green'; size=5; position='8'; output;
run;
/* Define the title and footnote */
title 'Distribution Center Locations';
footnote font=swiss j=r 'GANCITY';
/* Define pattern characteristics */
pattern value=mempty color=blue repeat=49;
/* Generate annotated map */
proc gmap data=lower48 map=lower48;
id state;
choro state / annotate=citystar discrete
nolegend;
run;
quit;

This example labels a map of the continental United States with the location and names of three cities. The GMAP procedure draws a map of the U.S. and an Annotate data set adds the stars and labels.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps
|
| Date Modified: | 2005-07-20 03:02:43 |
| Date Created: | 2005-05-23 14:11:33 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |