Sample 25558: Label the states on a U.S. map using PROC GMAP
This program uses an Annotate data set with PROC GMAP to display the state abbreviation in the center of each state.
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 program uses an Annotate data set with PROC GMAP to display the state abbreviation in the center of each state.
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';
/* Set the graphics environment */
goptions reset=all border cback=white htitle=13pt;
/* Create data set CENTER */
data center;
length function $ 8;
retain flag 0 xsys ysys '2' hsys '3' when 'a';
set maps.uscenter
(where=(fipstate(state) ne 'DC')
drop=long lat);
style = "'Albany AMT/bold'";
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 a title for the map */
title 'Positioning State Labels with MAPS.USCENTER';
/* 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;
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 program uses an Annotate data set with PROC GMAP to display 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 Elements ==> Annotation SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps
|
| 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 |