Procedure features: |
BY statement |
ID
statement |
|
Other features: |
SORT procedure |
MERGE statement |
LIBNAME
statement |
|
Sample library member: |
GRMUSMAP
|
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. Because the MAPS.US map data set does
not contain a variable to identify any unit area other than states, this example
creates a map data set that contains the census divisions and that can be
processed with the GREMOVE procedure.
The STATE variable in the MAPS.US data set, containing
numeric FIPS codes for each state, is used as the BY-variable to merge the
CBSTATES and MAPS.US data sets. The MAPS.US Data Set shows some of the variables that are present in the data set before using
the GREMOVE procedure:
The MAPS.US Data Set
MAPS.US Data Set
OBS STATE SEGMENT X Y
1 1 1 0.16175 -0.10044
2 1 1 0.12305 -0.10415
3 1 1 0.12296 -0.10678
.
.
.
1524 56 1 -0.18757 0.15035
1525 56 1 -0.10158 0.13997
1526 56 1 -0.10398 0.11343
Map before Removing Borders (GRMUSMAP(a)) shows the map before
processing:
Map before Removing Borders (GRMUSMAP(a))
The REMSTATE Data Set
shows the variables that are present in the data set after you use the GREMOVE
procedure. Notice that the new map data set contains a new variable called
DIVISION:
The REMSTATE Data Set
REMSTATE Data Set
OBS X Y SEGMENT DIVISION
1 0.29825 0.17418 1 1
2 0.29814 0.17820 1 1
3 0.30206 0.18045 1 1
.
.
.
1082 -0.18715 -0.16010 8 9
1083 -0.18747 -0.15971 8 9
1084 -0.18747 -0.15951 8 9
Map after Removing Borders (GRMUSMAP(b)) shows the new map after PROC GREMOVE
has removed interior state boundaries.
Map after Removing Borders (GRMUSMAP(b))
|
goptions reset=all border; |
|
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 PR 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
; |
|
proc sort data=cbstates out=cbsort;
by state;
run; |
|
data uscb;
merge cbsort maps.us;
by state;
run; |
|
proc sort data=uscb out=divstate;
by division;
run; |
|
proc gremove data=divstate out=remstate;
by division;
id state;
run; |
|
title "U.S. State Map";
footnote j=r "GRMUSMAP(a) "; |
|
pattern value=mempty color=blue; |
|
proc gmap map=maps.us data=maps.us all;
id state;
choro state / nolegend levels=1;
run; |
|
title "U.S. Census Division Map";
footnote j=r "GRMUSMAP(b) "; |
|
proc gmap map=remstate data=remstate all;
id division;
choro division / nolegend levels=1;
run;
quit; |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.