Sample 24896: Label counties at geographical center Version 9 and higher
/****************************************************************/
/* This sample program will annotate the county names on a map */
/* of Nevada. 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. */
/****************************************************************/
goptions reset=all;
/* Create a projected map of Nevada with county boundaries */
proc gproject data=maps.counties out=nevada;
/* State FIPS for Nevada */
where state=32;
id state county;
run;
quit;
/* Create a data set containing the names of the counties */
/* in Nevada. */
data nvnames;
set maps.cntyname;
/* State FIPS for Nevada */
where state=32;
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: */
/* <map-ds> Input Map data set */
/* <attr-ds> Attribute data set that contains var for label */
/* <out-ds> Resulting output data set for use in ANNO= in GMAP */
/* <var> Variable for label on <attr-ds>. Can be text or num */
/* <ids> Space-separated list of IDs that the map and attr */
/* data sets are sorted on. */
/* FONT= Font for the label. Default is SWISS. */
/* COLOR= Color of the label. Devault is BLACK. */
/* SIZE= Size of the label. Default is 1 <unit> */
/* HSYS= UNIT system for SIZE=. Default is 3 (PERCENT) */
%maplabel(nevada,nvnames,anno,countynm,state county,font='swiss',color=blue);
title "County Map of Nevada";
pattern1 v=me c=black r=15;
/* Generate a county map of Nevada with county labels */
proc gmap data=nevada map=nevada;
id state county;
choro county / anno=anno nolegend;
run;
quit;

This sample program users uses the %maplabel annotate macro to create
the annotate data set used with the GMAP procedure to label counties.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels
|
| 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 |