Chapter Contents

Previous

Next
The GMAP Procedure

Example 6: Labeling the States on a U.S. Map


Procedure features:
CHORO statement options:
ANNOTATE=
NOLEGEND
Other features:
Annotate Facility
Sample library member: GR19N06

[IMAGE]

This example uses the MAPS.USCENTER data set and the Annotate facility to add postal code labels to each state. The program first builds an Annotate data set that contains the instructions for drawing the labels. Some of the labels are in the center of the state and others use external labeling with leader lines. The CHORO statement assigns the Annotate data set to the map.

Note:   The coordinates in MAPS.USCENTER have been projected to match coordinates in the MAPS.US data set.  [cautionend]

 Note about code
libname reflib 'SAS-data-library';
libname maps 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(black blue green red)
         ftext=swiss htitle=6 htext=3;
 Note about code
data reflib.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);
 Note about code
   function='label';
   text=fipstate(state);
   size=2.5;
   position='5';
 Note about code
   if ocean='Y' then
      do;
         position='6';
         output;
         function='move';
         flag=1;
      end;
 Note about code
   else if flag=1 then
      do;
         function='draw';
         size=.25;
         flag=0;
      end;
   output;
run;
 Note about code
title 'Positioning State Labels with MAPS.USCENTER';
footnote j=r 'GR19N06 ';
 Note about code
pattern1 value=mempty color=blue repeat=50;
 Note about code
proc gmap data=maps.us map=maps.us;
   id state;
   choro state / nolegend
                 annotate=reflib.center;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.