Sample 24902: Create a regional block map with PROC GMAP
This sample program uses PROC GREMOVE to remove state boundaries followed by PROC GMAP to create a regional block map.
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 GREMOVE to remove state boundaries followed by PROC GMAP to create a regional block map.
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.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create map data set STATES1 by adding */
/* REGION to the US map data set */
data states1;
set maps.us;
select;
/* west */
when (state=53 or state=41 or state=16 or state=32 or state=06
or state=02 or state=15) region=1;
/* north central */
when (state=30 or state=46 or state=38 or state=31
or state=20 or state=56 or state=49
or state=08) region=2;
/* southwest */
when (state=04 or state=35 or state=48
or state=40) region=3;
/* midwest */
when (state=27 or state=19 or state=29 or state=55
or state=17 or state=26 or state=18
or state=39) region=4;
/* south */
when (state=05 or state=22 or state=01 or state=21 or state=47
or state=28 or state=13 or state=12 or state=45 or state=37
or state=51 or state=54) region=5;
/* new england */
otherwise region=6;
end;
run;
/* Create the response data set SITES */
data sites;
input Region Sites;
datalines;
1 1100
2 262
3 92
4 612
5 23
6 52
;
run;
/* Sort by REGION STATE. STATE must be included in the sort to */
/* preserve the original order of the points that comprise each state */
proc sort data=states1;
by region state;
run;
/* Remove the state boundaries since we only want one */
/* block per region */
proc gremove data=states1 out=map;
by region;
id state;
run;
title1 'Regional block map with PROC GMAP';
/* Generate the map */
proc gmap data=sites map=map all;
id region;
/* Use area=1 so that each region has a different pattern */
block sites / area=1 discrete;
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 GREMOVE to remove state boundaries followed by PROC GMAP to create a regional block map.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps ==> Other Maps Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps ==> Removing
|
Date Modified: | 2005-08-31 03:03:07 |
Date Created: | 2004-11-11 11:07:58 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | n/a | n/a |