For those of you who are impatient and want to cut to the chase, here's my final map. It's a SAS version of a map that appeared in a recent article on the bigmedicine.ca website. Click on it to see the interactive version with html hover-text.
I used the new mapsgfk maps that we started shipping in SAS 9.4 for this example. I started with the mapsgfk.Africa continent map, and used Proc Gproject to chop out just the rectangular area, based on latitude/longitude values, that was in the original article. (This is a technique I learned from Mike Zdeb's wonderful book Maps Made Easy Using SAS.)
proc gproject data=mapsgfk.africa out=my_map latlong eastlong degrees project=cylindri latmax=14.0 latmin=0 longmin=-20 longmax=-3.2; id id; run;
I created some map data so that the affected countries mapped to the light yellow color, and left the other countries gray (using 'cdefault=grayE1').
That was the easy/straightforward part. Next I needed to add the individual country maps for Guinea and Liberia. I was able to use mapsgfk.Guinea as-is, but mapsgfk.Liberia's areas were one level more granular than I needed (such as US counties, instead of states). Therefore I had to use Proc Gremove to group those lower-level areas into the desired areas. Once I had created these two maps, I combined them with the previous map, layering them such that these two new maps come last in the dataset, so they will show up "on top."
We've now got a map with the countries and areas together, but it's difficult to determine exactly which country the smaller areas are a part of. Therefore I took the country borders, and created an annotate dataset to draw a dark outline around each country using the poly/polycont annotate commands. This is an improvement over the original map, by the way!
And to finish it off, I annotated country and city names at specific latitude/longitude coordinates, and annotated a blue rectangle behind the map to represent the ocean. I annotated the "Capitals" marker to the legend, and added the date to the bottom/right. I added HTML hover-text to all the countries and areas within the countries, using the Gmap html= option, so you can mouse over them and see what the names are (which is another enhancement over the original map). Scroll back to the top of the blog to see the finished map.
As you can see, you can do a lot of customizations in SAS maps, and you can layer maps (and also annotations) to create some really detailed maps to help visualize and analyze your data. Now that you know what's possible, what data do you think it would be interesting to analyze on a map?
This post originally appeared in the SAS blog The SAS Training Post.