Sample library member: |
GEOSTRT
|
The following example illustrates the STREET geocoding method to obtain
coordinates based on street addresses. The ATTRIBUTEVAR= option specifies
an additional variable to include in the output data set.
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
data WORK.CUSTOMERS (label='Input data for street geocoding');
infile datalines dlm='#';
length address $ 32
city $ 24
state $ 2;
input address /* House number and street name */
zip /* Customer ZIP code (numeric) */
city /* City name */
state; /* Two-character postal code */
datalines;
555 Junk Street # 99999 # Beverly Hills # CA
305 Cross Lake Drive # 27526 # Fuquay-Varina # NC
2525 Banks Road # 27603 # Raleigh # NC
2222 SAS Campus Drive # 27513 # Cary # NC
1150 SE Maynard Rd. # 27511 # Cary # NC
2117 Graceland # 27606 # Raleigh # NC
1313 Mockingbird Lane # # Delray # CC
133 Jade Circle # 27545 # Knightdale # NC
1005 W South St # 27603 # Raleigh # NC
N Winds North Drive # 27591 # Wendell # NC
622 Roundabout Road # 27540 # Holly Springs # NC
Johnson Family Rd # 27526 # #
822 Water Plant Road # # Zebulon # NC
502 Possum Track Road # 27614 # # NC
2590 Wolfpack Lane # 27604 # Raleigh # NC
125 Ferris Wheel Ct # 27513 # Cary # NC
;
run; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc geocode /* Invoke geocoding procedure */
method=STREET /* Specify geocoding method */
data=WORK.CUSTOMERS /* Input data set of addresses */
out=WORK.GEOCODED /* Output data set with X/Y values */
lookupstreet=SASHELP.GEOEXM /* Primary street lookup data set */
attributevar=(TRACTCE00); /* Assign Census Tract to locations */
run;
proc print data=WORK.GEOCODED noobs;
var address m_addr m_zip m_obs _matched_ _status_ _notes_ _score_ x y tractce00;
run; |
The following output from the PRINT procedure shows the output data
set after running the GEOCODE procedure. In addition to the default output
variables, the TRACTCE00 attribute variable was added.
The GEOCODED Data Set
address M_ADDR M_ZIP M_OBS _MATCHED_ _STATUS_
555 Junk Street . . City mean City/State Match
305 Cross Lake Drive 305 Cross Lake Dr 27526 5098 Street Found
2525 Banks Road 2525 Banks Rd 27603 1189 Street Found
2222 SAS Campus Drive 199 Sas Campus Dr 27513 16786 Street Found
1150 SE Maynard Rd. 1150 SE Maynard Rd 27511 12467 Street Found
2117 Graceland 4400 Graceland Ct 27606 8022 Street Found
1313 Mockingbird Lane . . None
133 Jade Circle 173 Jade Cir 27545 9971 Street Found
1005 W South St 1005 W South St 27603 17643 Street Found
N Winds North Drive 27591 11009 ZIP ZIP match
622 Roundabout Road 530 Roundabout Rd 27540 16395 Street Found
Johnson Family Rd Johnson Family Rd 27526 10151 Street Found
822 Water Plant Road 822 Water Plant Rd 27597 20351 Street Found
502 Possum Track Road 502 Possum Track Rd 27614 15179 Street Found
2590 Wolfpack Lane 2590 Wolfpack Ln 27604 21291 Street Found
125 Ferris Wheel Ct 125 Ferris Wheel Ct 27513 6994 Street Found
_NOTES_ _SCORE_ X Y TRACTCE00
CT ST 10 -118.398 34.0695 .
AD ZC NMOS TY 55 -78.763 35.6061 53104
AD ZC NM TY 60 -78.673 35.6369 53103
AD ZC ENDNM TY 40 -78.763 35.8273 53510
AD ZC NM DP TY 70 -78.764 35.7835 53501
AD ZC ENDNM NOTYA 30 -78.711 35.7889 52402
0 . . .
AD ZC ENDNM TY 40 -78.461 35.8147 54102
AD ZC NM DP TY 70 -78.654 35.7732 51000
ZC 15 -78.388 35.7930 .
AD ZC ENDNM TY 40 -78.831 35.6505 53200
AD ZC NONM TY 40 -78.750 35.5395 53104
AD CT ST NMOS TY 50 -78.339 35.8319 54302
AD ZC NM TY 60 -78.629 35.9520 53801
AD ZC NMOS TY 55 -78.609 35.8234 52705
AD ZC NM TY 60 -78.800 35.7949 53515
![](../../../../common/63294/HTML/default/images/spacer.gif) |
![](../../../../common/63294/HTML/default/images/spacer.gif) |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.