/**********************************************************************/


data central;
 
set maps.uscounty;
   if state=stfips('ia')        /* select states in central           */
      or state=stfips('ks')     /* United States                      */
      or state=stfips('mo')
      or state=stfips('ne');
run;


/**********************************************************************/


proc gremove data=central out=outline;
   by state;
   id state county;
run;


/**********************************************************************/


data anno;
   retain  xsave ysave;
   drop    xsave ysave;
   length  function color $8;
   retain  xsys ysys '2'        /* use map data coordinate system     */
            color 'black'       /* color of state outlines            */
            size 6              /* thickness of state outlines        */
            when 'a';           /* annotation to be drawn after map   */
 
set outline;
by state segment ;
   if first.segment then do;    /* if first point in polygon          */
      function = 'move' ;       /* then move to that location         */
      xsave = x ;               /* and store coordinates in           */
      ysave = y ;               /* XSAVE and YSAVE variables          */
      output ;
      end;
   else do;                     /* if not first point, then draw      */
      function = 'draw';
      output ;
      if last.segment then do;  /* if last point in a segment         */
         x=xsave;               /* connect with first point in        */
         y=ysave;               /* segment to complete polygon        */
         output ;
         end;
      end;
run;


/**********************************************************************/


data resp;
   input statec $ county  anthills;
   state=stfips(statec);
cards;
ia 1 15
ia 3 27
ia 5 34
ia 7 13
. . .
. . .
. . .
. . .
ks 1 22
ks 3 16
ks 5 38
. . .
. . .
. . .
mo 1  8
mo 3 15
mo 5 32
mo 7 19
. . .
. . .
. . .
ne 1  7
ne 3 33
ne 5 22
run;


/**********************************************************************/


proc format;
value antfmt  0-10='0-10'
             11-20='11-20'
             21-30='21-30'
             31-40='31-40';
run;


/**********************************************************************/


goptions target=psl rotate=landscape htext=2 pct ftext=swiss;
proc gmap data=resp map=central;
   id state county;
   choro anthills/
         anno=anno              /* annotate data set containing state */
                                /* outlines                           */
         discrete
         coutline=black         /* color for county outlines          */
         legend=legend1;
format anthills antfmt.;
legend1 frame label=(j=c '# OF ANT HILLS'
                     j=c '(IN MILLIONS)');
pattern1 v=msolid c=graydd;
pattern2 v=msolid c=grayaa;
pattern3 v=msolid c=gray88;
pattern4 v=msolid c=gray55;
title f=swissb h=5 pct 
      'ANT HILL DISTRIBUTION IN CENTRAL REGION';
run;