Sample 25592: Removing state boundaries from a U.S. map using PROC GREMOVE
This sample uses the MAPS.US map data set with PROC GREMOVE to produce a new map data set containing boundaries for the U.S. Bureau of the Census divisions.
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 uses the MAPS.US map data set with PROC GREMOVE to produce a new map data set containing boundaries for the U.S. Bureau of the Census divisions.
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.
/* Define the libref of MAPS if necessary */
*libname maps 'location-of-map-datasets';
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create the sample data set CBSTATES */
data cbstates;
length State 8 Stcode $ 2 Division 4;
input Stcode Division;
State=stfips(stcode);
drop stcode;
datalines;
CT 1
MA 1
ME 1
NH 1
RI 1
VT 1
PA 2
NJ 2
NY 2
IL 3
IN 3
MI 3
OH 3
WI 3
IA 4
KS 4
MN 4
MO 4
ND 4
NE 4
SD 4
DC 5
DE 5
FL 5
GA 5
MD 5
NC 5
SC 5
VA 5
WV 5
AL 6
KY 6
MS 6
TN 6
AR 7
LA 7
OK 7
TX 7
AZ 8
CO 8
ID 8
MT 8
NM 8
NV 8
UT 8
WY 8
AK 9
CA 9
HI 9
OR 9
WA 9
;
run;
/* Sort data set in FIPS-code order */
proc sort data=cbstates out=cbsort;
by state;
run;
/* Merge DIVISION variable into map data set */
data uscb;
merge cbsort maps.us;
by state;
run;
/* Sort data set in DIVISION order */
proc sort data=uscb out=divstate;
by division;
run;
/* Remove interior boundaries within divisions */
proc gremove data=divstate out=remstate;
by division;
id state;
run;
/* Add a title to the map */
title1 'U.S. State Map (before GREMOVE)';
/* Define pattern characteristics */
pattern value=mempty repeat=48 color=black;
/* Show the original map */
proc gmap map=maps.us data=maps.us all;
id state;
choro state / nolegend;
run;
quit;
/* Define a new title for the map */
title1 'U.S. Census Division Map (after GREMOVE)';
/* Show the regional map */
proc gmap map=remstate data=remstate all;
id division;
choro division / nolegend;
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 uses the MAPS.US map data set with PROC GREMOVE to produce a new map data set containing boundaries for the U.S. Bureau of the Census divisions.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GREMOVE SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps
|
| Date Modified: | 2005-09-22 03:03:12 |
| Date Created: | 2005-05-23 14:17:39 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |