Sample 25592: Removing state boundaries from U.S. map using PROC GREMOVE
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 2, Chapter 25.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GRMUSMAP |
| TITLE: GRMUSMAP-Removing State Boundaries from U.S. Map |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS GOPTIONS GMAP GREMOVE MAPS PATTERN |
| PROCS: GMAP GREMOVE |
| DATA: EXTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
| MISC: EDIT AND UNCOMMENT THE LIBNAME STATEMENTS |
| IF THE LIBREFS HAVE NOT BEEN DEFINED. |
+-------------------------------------------------------------+*/
/* Define the libref maps */
*libname maps 'SAS-data-library';
/* Set the graphics environment */
goptions reset=all gunit=pct border cback=white
colors=(black blue green red)
ftext=swiss htitle=6 htext=3;
/* Create 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
;
/* 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;
/* Define title and footnote for map */
title 'U.S. State Map';
footnote j=r 'GRMUSMAP(a) ';
/* Define pattern characteristics */
pattern value=mempty repeat=48 color=blue;
/* Show the original map */
proc gmap map=maps.us data=maps.us all;
id state;
choro state / nolegend;
run;
/* Define new title and footnote for map */
title 'U.S. Census Division Map';
footnote j=r 'GRMUSMAP(b) ';
/* Show the regional map */
proc gmap map=remstate data=remstate all;
id division;
choro division / nolegend;
run;
quit;

This example processes the MAPS.US map data set, supplied with SAS/GRAPH, to produce a new map data set containing boundaries for the U.S. Bureau of the Census divisions and that can be processed with the GREMOVE procedure.
| 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 |