Sample 24896: Label counties at their geographical center with PROC GMAP
This sample program uses PROC GMAP with the %MAPLABEL annotate macro to label counties at their geographical center.
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 program uses PROC GMAP with the %MAPLABEL annotate macro to label counties at their geographical center.
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.
/****************************************************************/
/* This sample program annotates the county names on a map */
/* of Vermont. It uses the %MAPLABEL annotate macro to create */
/* the annotate data set used with the GMAP procedure. */
/* This annotate macro is available beginning with Version 9 of */
/* the SAS System. */
/****************************************************************/
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create a projected map of Vermont with county boundaries */
proc gproject data=maps.counties out=vermont;
/* State FIPS for Vermont */
where state=50;
id state county;
run;
quit;
/* Create a data set containing the names of the counties */
/* in Vermont. */
data vtnames;
set maps.cntyname;
/* State FIPS code for Vermont */
where state=50;
run;
/* Make the annotate macros available */
%annomac;
/* Use the MAPLABEL annotate macro to create an annotate data set */
/* to label the counties. */
/* The macro parameters are: */
/* Input Map data set. */
/* Attribute data set that contains variable for the label. */
/* Resulting output data set for use in ANNO= in GMAP. */
/* Variable for label on. Can be text or numeric. */
/* Space-separated list of IDs that the map and attribute */
/* data sets are sorted on. */
/* FONT= Font for the label. */
/* COLOR= Color of the label. Default is BLACK. */
/* SIZE= Size of the label. Default is 1. */
/* HSYS= UNIT system for SIZE=. Default is 3 (PERCENT). */
%maplabel(vermont,vtnames,anno,countynm,state county,font='Albany AMT/bold',
color=black,size=2.1);
title1 "County Map of Vermont";
pattern1 v=me c=black r=15;
/* Generate a county map of Vermont with county labels */
proc gmap data=vermont map=vermont;
id state county;
choro county / anno=anno nolegend coutline=grayaa;
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 sample program uses PROC GMAP with the %MAPLABEL annotate macro to label counties at their geographical center.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Annotation
|
Date Modified: | 2005-08-24 16:06:30 |
Date Created: | 2004-11-11 11:07:57 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | 9 TS M0 | n/a |