GEOCODE Procedure

Example 7: Australian Postcode Geocoding

Features:

ZIP geocoding method

Procedure Options:
METHOD=
DATA=
OUT=
LOOKUP=
ADDRESSZIPVAR=
LOOKUPZIPVAR=
Other features:
Base SAS functions:
SAS DATA step
PRINT procedure
Data set: lookup.postcodes (Postcode lookup data from MapsOnline)
Sample library member: GEOZIPAU
This example illustrates the ZIP geocoding method using Australian postcodes. Lookup data can be downloaded from SAS MapsOnline ( http://support.sas.com/rnd/datavisualization/mapsonline/html/downloads.html). See Non-U.S. Postcodes for details.

Output

The following output from the PRINT procedure shows the GEOCODED_STADIUMS output data set after running the GEOCODE procedure.
The GEOCODED_STADIUIMS Output Data Set with ZIP Method Variables
The GEOCODED_STADIUMS Output Data Set with ZIP Method Variables
The LIBNAME statement assigns the library name LOOKUP to the location where the Australian postcode lookup data is installed. You must edit the ‘pathname’ in the following LIBNAME statement to reference the lookup data location on your system.
libname lookup 'pathname';
Generate the STADIUMS input data set of names and addresses that the GEOCODE procedure will use.Each variable is delimited by a comma. Maximum variable lengths are specified.
data stadiums (label='Australian National Rugby League (NRL) stadiums');
  infile datalines dlm=',';
  length team $32 stadium $32 city $ 24 state $32 postcode $4;
  input team        /* NRL team name    */
        stadium     /* Stadium name     */
        city        /* City name        */ 
        state       /* State name       */
        postcode;   /* Stadium postcode */
datalines;
South Sydney Rabbitohs, ANZ Stadium, Sydney, New South Wales, 2127
Sydney Roosters, Sydney Football Stadium, Moore Park, New South Wales, 2021
Canterbury Bulldogs, ANZ Stadium, Sydney, New South Wales, 2127
Parramatta Eels, Parramatta Stadium, Sydney, New South Wales, 2150
Manly-Warringah Sea Eagles, Brookvale Oval, Brookvale, New South Wales, 2100
Cronulla-Sutherland Sharks, Toyota Park, Woolooware, New South Wales, 2230
Penrith Panthers, Centrebet Stadium, Penrith, New South Wales, 2750
Canberra Raiders, Canberra Stadium, Bruce, Australian Capital Territory, 2617
Brisbane Broncos, Suncorp Stadium, Milton, Queensland, 4064
Newcastle Knights, Hunter Stadium, New Castle, New South Wales, 2292
North Queensland Cowboys, Dairy Farmers Stadium, Townsville, Queensland, 4817
Melbourne Storm, AAMI Park, Melbourne, Victoria, 3000
St. George Illawarra Dragons, WIN Jubilee Oval, Carlton, New South Wales, 2217
Wests Tigers, Campbelltown Stadium, Leumeah, New South Wales, 2560
Wests Tigers, Leichhardt Oval, Leichhardt, New South Wales, 2040 
Wests Tigers, Sydney Football Stadium, Sydney, New South Wales, 2021
Gold Coast Titans, Skilled Park, Gold Coast, Queensland, 4226
;
run;
Run the GEOCODE procedure with the generated STADIUMS input data set. Specify that GEOCODE use the ZIP method to look up each stadium address. The input data contains address information about Australian National Rugby League stadiums. The GEOCODE procedure uses the postcode from each address in the input data to match observations in the lookup data set.
proc geocode             /* Invoke geocoding procedure       */
  method=zip              /* Specify geocoding method         */
  data=stadiums           /* Input data of stadiums           */
  out=geocoded_stadiums   /* Output data set of locations     */
  lookup=lookup.postcodes /* Lookup data with postcodes       */
  addresszipvar=postcode  /* Postcode variable in input data  */
  lookupzipvar=poa_code;  /* Postcode variable in lookup data */
run;
Print the entire GEOCODED_STADIUMS output data set, suppressing the observation column.
proc print data=geocoded_stadiums noobs;
run;
quit;