Chapter Contents

Previous

Next
The GMAP Procedure

Example 3: Assigning a Format to the Response Variable


Procedure features:
BLOCK statement options:
AREA=
CBLKOUT=
COUTLINE=
DISCRETE
Other features:
FORMAT statement
LEGEND statement
PATTERN statement
Data set: REFLIB.SITES
Sample library member: GR19N03

[IMAGE]

This example creates a format that defines the ranges of values for the response values and assigns this format to the response variable. These ranges appear in the legend and make the map easier to understand. When a format is assigned to a numeric response variable, the DISCRETE option must be used so that each formatted value is treated as a separate response level.

The example also patterns the map areas by region. To do this, both data sets must contain the ID variable, REGION. The response data set, REFLIB.SITES, already contains REGION, so the program only needs to add it to the map data set. Then the map data set is sorted by both the ID variables, REGION and STATE. Finally, the AREA= option specifies that the ID variable REGION is the one by which the map areas are patterned.
 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.states1;
   set maps.us;
   select;
      when (state in (9,23,25,33,44,50))       region=1;
      when (state in (34,36))                  region=2;
      when (state in (10,11,24,42,51,54))      region=3;
      when (state in (1,12,13,21,28,37,45,47)) region=4;
      when (state in (17,18,26,27,39,55))      region=5;
      when (state in (5,22,35,40,48))          region=6;
      when (state in (19,20,29,31))            region=7;
      when (state in (8,30,38,46,49,56))       region=8;
      when (state in (4,6,15,32))              region=9;
      otherwise                                region=10;
   end;
run;
 Note about code
proc sort data=reflib.states1 out=reflib.states2;
   by region state;
run;
 Note about code
proc format;
   value sitesfmt low-24='0-24'
                  25-49='25-49'
                  50-74='50-74'
                  75-99='75-99'
                  100-high='over 100';
run;
 Note about code
title1 'Hazardous Waste Site Installations (1997)';
footnote j=r 'GR19N03 ';
 Note about code
pattern1 value=m3n0 r=3;
 Note about code
pattern2 value=solid color=green;
pattern3 value=solid color=cyan;
pattern4 value=solid color=lime;
pattern5 value=solid color=blue;
pattern6 value=solid color=red;
 Note about code
legend1 shape=bar(2,4) across=5
        value=(j=l)
        label=('Number' j=l 'of Sites:')
        frame;
 Note about code
proc gmap map=reflib.states2 data=reflib.sites;
   format sites sitesfmt.;
   id region state;
   block sites / discrete
                 area=1
                 legend=legend1
                 shape=block
                 cblkout=black
                 coutline=black;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

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