You've got a database containing the addresses of all your customers ... but how can you plot them on a map or analyze them spatially? First, you'll need to convert the address into a numeric coordinate (latitude & longitude). SAS can do that ... with Proc Geocode!
But before we get into geocoding street addresses, here's a little diversion from my buddy (and Olympic gold winner) Joe Jacobi. Joe spends so much time on the water, that he probably doesn't even have a street address, LOL! So, how would you estimate a lat/long for him?!? ... Perhaps you could try a "wild guess"! Feel free to leave your wild guess of Joe's lat/long location in this photo in the comments section! :)
And now, on to Tip #6 - Geocoding your addresses!
First, you'll need to have your address data split up into separate variables, like the following. The data I'm using as an example is the address of SAS' headquarters. Note that the zip variable is numeric (not character):
Here's the code I used to create the data for my example, if you'd like to try running it as you follow along ...
length address $50 city $50 state $2;
infile datalines dlm=',';
input address city state zip;
100 SAS Campus Drive, Cary, NC, 27513
Once your address data is stored in the desired format, all you have to do is run it through Proc Geocode. Note that in this simple example, I'm using the small lookup table for Wake county, NC, that we ship in the sashelp samples library. You'll want to download the full US lookup table to use on your addresses - it is several GB in size, and can be downloaded from the SAS maps online page.
proc geocode data=my_addresses out=my_addresses
Once you run your address data through Proc Geocode, variables will be added for the latitude & longitude:
And now that you have the lat/long coordinates, you can do things like plot markers on a map. Here's a link to the complete code I used to geocode the data and plot it on the map.
Many of the other companies that provide geocoding charge you per-address, or only allow a certain number of addresses to be geocoded for free (and then charge after that). Also, many of the geocoding services perform the geocoding on their computer (rather than yours), which means they have access to your address data ... that could be a problem, if you need to keep your data confidential/secret. But with SAS' geocoding, on the other hand, you run everything on your own computer, and you can geocode as many addresses as you want, without getting charged extra! :-)
Click here to see all my tips about mapping tools!