Sample 25558: Labeling the states on a U.S. map using PROC GMAP
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 2, Chapter 19.
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: GMPLABEL |
| TITLE: GMPLABEL-Labeling the States on a U.S. Map |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS MAPS GMAP |
| PROCS: GMAP |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
| MISC: EDIT AND UNCOMMENT THE LIBNAME STATEMENTS |
| IF THE LIBREFS HAVE 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=swiss htitle=6 htext=3;
/* Create data set CENTER */
data center;
length function $ 8;
retain flag 0 xsys ysys '2' hsys '3' when 'a'
style 'swiss';
set maps.uscenter
(where=(fipstate(state) ne 'DC')
drop=long lat);
function='label';
text=fipstate(state);
size=2.5;
position='5';
if ocean='Y' then
do;
position='6';
output;
function='move';
flag=1;
end;
else if flag=1 then
do;
function='draw';
size=.25;
flag=0;
end;
output;
run;
/* Define title and footnote for map */
title 'Positioning State Labels with MAPS.USCENTER';
footnote j=r 'GMPLABEL';
/* Define pattern characteristics */
pattern1 value=mempty color=blue repeat=50;
/* Display the choropleth map */
proc gmap data=maps.us map=maps.us;
id state;
choro state / nolegend
annotate=center;
run;
quit;

This program builds an Annotate data set that labels the state abbreviation in the center of each state.
| Type: | Sample |
| Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps SAS Reference ==> Procedures ==> GMAP
|
| Date Modified: | 2005-08-27 03:03:23 |
| Date Created: | 2005-05-23 14:15:27 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |