A new prospective customer enters their personal information on your web page, and they want to have a sales rep contact them ... but you need to know which sales region they're in, so you can assign them to a sales team. Now, multiply that by thousands of prospective customers! You need a way to automate the process, and we've got a SAS mapping tool that can help!

But before we get started, here's a little fun quiz. In the style of Where in the world is Carmen Sandiego, can you guess where my friend's mom Suzanne is in this photo? (feel free to leave your guess in a comment)

And now, on to the mapping tools! ... In your case, you will probably have customer street addresses, and you can run them through Proc Geocode to estimate their lat/long coordinates. I'm going to cheat a little, and just grab a few cities from one of our sample datasets, and use their lat/long coordinates. To make it interesting, I'm choosing cities named Cleveland (bet you didn't know there were so many cities named Cleveland in the US!) Below is a screen capture, showing a few of the 28 matches. We'll call these our 'customers'.

You could use Proc GProject on the data, and create an annotate dataset, and plot these customers as dots on your sales region map. This requires quite a bit of code, and it looks good ... but this is not the approach you should take.

You don't just want to see what sales region the dots are in, you want to have that info in a dataset so you can programmatically do things with it. What you need is Proc GInside! This proc will tell you what map area each lat/long coordinate is inside of and add that information to your dataset. Below is the basic syntax, followed by a screen capture of the output table showing which sales region each of the customers is in. (Here is a link to the SAS code I used.)

You can use Proc GInside with a traditional map (like the sales region map above), or you can even 'draw' special map polygons such as the 40 mile radius circle in the map below, and determine which customers are inside that polygon. (Here is a link to the SAS code I used.)

Now that you know about Proc GInside, what are you planning to use it for? (Feel free to share your ideas in the comments!) And my clever readers are probably thinking, "If I knew Suzanne's lat/long in the photo, I could even use Proc GInside to figure out where in the world she is!"