Tracking Ebola: Layering customized SAS maps


There are many ways to use SAS in Health & Life Sciences, and one of my favorite is using it to track the spread of diseases. This post demonstrates how to layer several customized maps to track the recent Ebola outbreak in Africa.

In this blog post, I describe how I created a SAS version of an ebola map that appeared in a recent article on the website. Here's a screen capture of the original map:

For those of you who are impatient and want to "cut to the chase" here's my final SAS map (looks pretty similar, eh!?!). Click the thumbnail below to see the full size interactive version of my map with html hover-text.



And here are the technical details of how I created this map...

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 out=my_map latlong eastlong degrees 
 latmax=14.0 latmin=0
 longmin=-20 longmax=-3.2;
id id;

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 :) Now I need 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 1 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 take the country borders, and create 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 annotate country & city names at specific latitude/longitude coordinates, and annotate a blue rectangle behind the map to represent the ocean. I annotate the 'Capitals' marker to the legend, and add the date to the bottom/right. I add 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?



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

Back to Top