I recently read an article that listed the 100 best restaurants in the US - but the article didn't have a map. I decided to use my SAS skills to change that!
When it comes to restaurants, I eat out a lot (and by 'a lot' I mean I never eat at home, lol). My personal favorites are Bojangles, Ole Time Barbecue, and D&S Cafeteria - you can probably tell I don't have the most sophisticated dining tastes, but I do like good food! Every food blog needs a photo of a great meal to get you in the mood, and here's a picture from my foodie friend Claudia - now that's some good eatin'! ...
And now, back to the Top 100 list...
When I recently saw OpenTable.com's article I thought it would be interesting to check their list and see how many of the restaurants were close to where I live, and see if I had perhaps eaten at any of them. When I tried to check their list (which was sorted alphabetically by restaurant name), it was a daunting task! It contained pictures of all the restaurants, and their names & addresses - but there was no map, and no way to easily narrow it down to a certain geographical area (such as the area where I live, or the areas I've visited). Here's a screen-capture of how they present the info:
What would a SAS Graph guy do in a situation like this?...
You guessed it! -- I saved the html code from the web page into a text file, and wrote some SAS code to parse the restaurant names & addresses out of the html. I then used Proc Geocode to estimate the latitude & longitude of each restaurant, and programmatically annotated markers at those locations on a SAS/Graph gmap. You can hover over the markers to see the restaurant names, and click on the markers/states to see a test list of all the winning restaurants in that state. And in the text list, you can click the restaurant name to see the opentable.com information about that restaurant.
Here's a snapshot of my SAS map - click it to see the interactive version with html hover-text and drilldowns:
With my SAS map & drilldown table, I was able to quickly see that 6 North Carolina restaurants made it into the Top 100, and 5 of those 6 are very close to Cary (where I live). One is actually right beside SAS headquarters - Herons - and I have eaten there!
How many of the Top 100 have you eaten at? If you ever come to SAS headquarters, perhaps you can eat at Herons and add it to your list :-)
4 Comments
Thanks! Did you use some web scraping utility to create this text file?
I saved their entire html file, and then deleted all the lines except these (manually, using a text editor).
Nice work! Would it be possible to get the 'best_restaurants_2014.txt' file?
Thanks,
Brian
Here you go!
http://www.robslink.com/SAS/democd75/best_restaurants_2014.txt