Sample 25499: Label cities on a map using PROC GMAP
The sample code on the Full Code tab labels a map of the continental United States with the locations and names of three cities. The GMAP procedure draws a map of the U.S. and uses an Annotate data set to add the stars and labels.
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 labels a map of the continental United States with the locations and names of three cities. The GMAP procedure draws a map of the U.S. and uses an Annotate data set to add the stars and labels.
The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Define the libref of MAPS if necessary */
*libname maps 'SAS-MAPS-library';
/* Subset US data set */
data lower48;
set maps.us;
if state ne stfips('AK');
if state ne stfips('HI');
if state ne stfips('PR');
run;
/* Create the Annotate data set, CITYSTAR */
data citystar;
length function color $ 8 position $ 1
text $ 20 style $ 30;
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='black'; size=5; output;
/* Create the observation for a city */
function='label'; style="'Albany AMT/bold'"; text=city;
color='vibg'; size=5; position='8'; output;
run;
/* Define the title */
title 'Distribution Center Locations';
/* Define pattern characteristics */
pattern value=mempty color=blue repeat=49;
/* Generate the annotated map */
proc gmap data=lower48 map=lower48;
id state;
choro state / annotate=citystar discrete nolegend;
run;
quit;
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 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 ==> Annotation SAS Reference ==> Procedures ==> GMAP
|
Date Modified: | 2023-04-20 10:29:55 |
Date Created: | 2005-05-23 14:11:33 |
Operating System and Release Information
SAS System | SAS/GRAPH | Tru64 UNIX | 9 TS M0 | |
Linux | 9 TS M0 | |
OpenVMS Alpha | 9 TS M0 | |
HP-UX IPF | 9 TS M0 | |
64-bit Enabled Solaris | 9 TS M0 | |
64-bit Enabled AIX | 9 TS M0 | |
64-bit Enabled HP-UX | 9 TS M0 | |
Microsoft Windows XP Professional | 9 TS M0 | |
Microsoft Windows Server 2003 Standard Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9 TS M0 | |
Microsoft Windows 2000 Professional | 9 TS M0 | |
Microsoft Windows NT Workstation | 9 TS M0 | |
Microsoft Windows 2000 Server | 9 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 9 TS M0 | |
Microsoft Windows 2000 Advanced Server | 9 TS M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9 TS M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9 TS M0 | |
z/OS | 9 TS M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | |