Previous Page | Next Page

The GEOCODE Procedure

Example 1: Geocoding Using Default Values


Sample library member: GEOSMPL

The following sample shows the simplest form of the GEOCODE procedure specifying only the OUT= option to geocode by five-digit ZIP code. The default lookup data set, SASHELP.ZIPCODE, is used.

 Note about code
data CUSTOMERS (label="Customer data for geocoding");
infile datalines dlm='#';
   length address $ 24 city $ 24 state $ 2;
   input address  /* House number and street name */
         zip      /* Customer ZIP code (numeric)  */
         city     /* City name                    */
         state    /* Two-character postal code    */   ;
   cust_ID = _n_;   /* Assign customer ID number    */
datalines;
555 Junk Street # 99999 # Beverly Hills # CA
115 E. Water St # 19901 # Dover #
760 Moose Lodge Road # 19934 # Camden #
200 S. Madison Str # 19801 # Wilmington # DE
4701 Limestone Road # 19808 # Wilmington #
2117 N 4th St # 19363 # Oxford # PA
1313 Mockingbird Lane # . # Delray # CC
133 Silver Lake Dr # 19971 # Rehoboth Beach # DE
11 SE Front Street # 19963 # Milford # DE
402 Nylon Boulevard # . # Seaford # DE
363 E Commerce St # . # Smyrna # DE
5595 Polly Branch Rd # 19975 # Selbyville # DE
1209 Coastal Highway # 19944 # Fenwick Island # DE
2899 Arthursville Rd # 19953 # Hartly # DE
41 Bramhall St # . #  #
9320 Old Racetrack Rd # . # Delmar # DE
281 W Commerce Str # 19955 # Kenton #
211 Blue Ball Road # 21921 # Elkton # MD
3893 Turkey Point Rd # 19980 # Woodside # DE
;
run;
 Note about code
proc geocode out=geocoded_customers;
run;
proc print data=geocoded_customers noobs;
run;

The result of using all of the default values is that the following is true:

The following output from PROC PRINT shows the output data set after running the GEOCODE procedure. Notice that the following geocoding variables have been added:

The GEOCODED_CUSTOMERS Data Set

   Y        X    _MATCHED_ address                zip  city           state cust_ID

34.0695 -118.398 City mean 555 Junk Street       99999 Beverly Hills   CA       1
39.1500  -75.532 ZIP       115 E. Water St       19901 Dover                    2
39.0953  -75.570 ZIP       760 Moose Lodge Road  19934 Camden                   3
39.7366  -75.549 ZIP       200 S. Madison Str    19801 Wilmington      DE       4
39.7317  -75.669 ZIP       4701 Limestone Road   19808 Wilmington               5
39.7877  -75.961 ZIP       2117 N 4th St         19363 Oxford          PA       6
  .         .    None      1313 Mockingbird Lane     . Delray          CC       7
38.7265  -75.081 ZIP       133 Silver Lake Dr    19971 Rehoboth Beach  DE       8
38.9035  -75.432 ZIP       11 SE Front Street    19963 Milford         DE       9
38.6387  -75.611 City      402 Nylon Boulevard       . Seaford         DE      10
39.2912  -75.606 City      363 E Commerce St         . Smyrna          DE      11
38.4663  -75.150 ZIP       5595 Polly Branch Rd  19975 Selbyville      DE      12
38.4593  -75.053 ZIP       1209 Coastal Highway  19944 Fenwick Island  DE      13
39.1509  -75.693 ZIP       2899 Arthursville Rd  19953 Hartly          DE      14
  .         .    None      41 Bramhall St            .                         15
38.4557  -75.574 City      9320 Old Racetrack Rd     . Delmar          DE      16
39.2282  -75.666 ZIP       281 W Commerce Str    19955 Kenton                  17
39.6264  -75.850 ZIP       211 Blue Ball Road    21921 Elkton          MD      18
39.0695  -75.567 ZIP       3893 Turkey Point Rd  19980 Woodside        DE      19

Previous Page | Next Page | Top of Page