Avast Mateys! Did you know that International Talk Like a Pirate Day is coming up?!? (September 19)
Here's the official website, if you'd like more info.
And what better way to get into the spirit of things than to use SAS/GRAPH to plot some real pirate data - Arrrr!!!
Here's a gmap showing the locations of pirate attacks this year. Click this link (or the map below) to see the full-size interactive map where you can hover over the markers for more information about individual attacks, and click the markers to drill down to a full report about the attack!
There's also a gplot of the same data below the map, so you can see how many attacks have happened over the course of the year, and look for trends:
And a table of all the attacks (color-coded the same as the markers in the map and graphs) if you're more of a table person. Here's a screen capture of the first few observations in the table:
Note that this is more than just a 'fun' example - there are a lot of neat SAS 'tricks' being used here!
- The attack lat/long locations are read directly from the HTML of a web page, using some code that Rick Langston helped me develop. All of the data was on a single very long line in the HTML, which required us to get somewhat tricky.
- I reused the same colored markers from the map, in the plot, by just changing their x/y coordinates. (rather than letting gplot color the markers) This guarantees that the colors match between the map and the plot.
- The colored dots have HTML mouse-over text, and when you click them they drill down to the detailed report on that attack.
- I use a user-defined format to control the background color in the "proc print" table, so they match the marker colors.
- There's an annotated image (pirate flag) on the map, as well as a custom annotated color legend.
Doesn't this inspire you to learn more SAS tricks?!? Click here to see the actual code used.
P.S. If you leave a comment, please "Talk Like a Pirate" -- Arrr!!! b)