Hey! Where have you been?!?


There's recently been a "States I've Visited" application going around on Facebook, where users create a map showing all the US states they've visited, and then post it on their page for their friends to see. I wondered if SAS could do a better job?...

Here's a screen-capture of one of my friends' map, created with the m.maploco.com application. It's a pretty simple map, using two colors, and from a visual perspective I have no complaints. It's a good map.

But when I thought about creating my own map, I felt a bit limited by the application. For example, there are certain states that I've visited, but only while I was driving through that state to get somewhere else. And I also wanted to provide some details about where I went in the state, or what I did there.

Therefore I used SAS to create my own map, so I could do it the way I wanted. I made the states I had driven through a lighter red, to distinguish them from states I'd actually spent quality time in. And I added html hover-text with more information about my 'visit' to each state. Below is a snapshot of my map - click it to see the full-size map with html hover-text:


Feel free to download my code, and modify it to create your own map (and post it to your Facebook page, or wherever you want). Who knows, you might even want to add some changes and enhancements!



About Author

Robert Allison

The Graph Guy!

Robert has worked at SAS for over a quarter century, and his specialty is customizing graphs and maps - adding those little extra touches that help them answer your questions at a glance. His educational background is in Computer Science, and he holds a BS, MS, and PhD from NC State University.

Related Posts


  1. Robert, I like this idea and was trying to create my own version. I found a small bug. Since I have been to Hawaii, the 'yes_no' field is filled with 1 and the 'ocean' field is populated with N by default. It ends up that my map doesn't show the statecode for Hawaii (the color is white). Not sure how to deal with it to solve the problem. Can you please check and advise? Thanks.

    • Robert Allison
      Robert Allison on

      Aha! - Good catch!

      Hawaii is a special case, in that although the label is over the ocean, it isn't treated as an 'ocean' label in the data. Therefore it's getting a white 'HI' label, but it's printed in the white ocean (rather than over the pink land of Hawaii, which would be too small for the label to fit on). Therefore I've added a special case at the bottom of the data step where I create the 'maplabel' dataset to handle Hawaii's label a little differently than the others. Download the (new/updated) SAS code again, and see if that works better. And thanks for the heads-up!

  2. Alison Bolen

    Hello? You know we're dying to hear about the MySpace mini convention, right? Among other things. But spill on the MySpace details first, please. (These maps would be so much more popular on Facebook with your level of just enough detail to raise all kinds of questions.)

    • Robert Allison
      Robert Allison on

      Hahaha! ... You know the old saying - "What happens in Atlantic City, stays in Atlantic City!" ;)

  3. Andrew T. Kuligowski on

    I used something like this as one of my first forays into SAS/Graph, back in ... well, let's just say that I used a release that was still identified by the YEAR rather than a sequential number. Of course, back then, I had a LOT more gray-colored states on my maps.

  4. Michelle Buchecker on

    Driving thru a state totally counts as having been there. Airports only count if you step off airport grounds. These are the rules. I didn't make them up. :-) Now if I can only get my last 5 states....

  5. This is very neat... And would make SAS very fun for students! Does SAS have a world map? Could this code be slightly altered to create a world map of places visisted??

    • Robert Allison

      Good idea! - Yes, SAS ships a world map with SAS/Graph (and maps for the individual countries as well!)

  6. Robert

    This is a really interesting idea - however coming from the UK my experience of travelling around the USA will be somewhat different to that of your US readers.

    I think I'd need an extra category for those states I technically visited but never did so in any meaningful way, for example when I went to SAS Global Forum 2008 it wasn't possible at the time (it may be different now) to fly direct from Europe to San Antonio so I had to change planes in Atlanta on the way to the conference and Cincinnati on the way home. This means that I've "technically" visited both Georgia and Ohio even though in neither case did I set foot outside the airport............


    • Robert Allison

      Ahh! - you might want a 3rd color in your map then!
      Perhaps an even lighter shade of red, for states that you've only been in the airport :)

    • Chris, just to clarify ... the Cincinnati airport is actually located just across the Ohio River in Kentucky, NOT Ohio.

      • Robert Allison
        Robert Allison on

        Steven - next you'll be saying that Kansas City is in Missouri, rather than Kansas! ... that's crazy talk! ;)

      • Steven

        Ah my knowledge of US geography isn't as good as I thought it was! Now if I could only figure out whether Dallas/Fort Worth International is in Dallas or Fort Worth I'll be all set for next years conference :-)


  7. Service calls on pallet-making machines! Like the additional hover-text information provided. You've inspired me to want to create a world map of my travels, except that I may need to recall from back-up my visits ;-)

Back to Top