As you travel around the world, do you know where English, French, Spanish, and Arabic are spoken? This blog will help you quickly answer that question, with some cool SAS maps!
But first, here's a picture of my friend Joy posing beside an interesting sign during one of her international trips. Do you know what languages are used on this sign? Can you translate the message/warning? And for bonus points, if you can understand both languages, do they both say the same thing? :)
And now, on to the SAS maps!
I recently saw a map animation on dadaviz.com, that cycled through 4 maps showing which countries English, French, Spanish, and Arabic are 'official languages' in. I liked the way the maps looked, but the animation aspect of it perplexed me - I would have much rather been able to study each map separately, and had hover-text over each country so I could see the country names.
So I set about creating my own version of the maps using SAS software. First I tracked down the lists of countries where each language is spoken (see the Wikipedia pages for English, French, Spanish, and Arabic), and read the lists into a SAS dataset. I then wrote a short macro that lets me pass in a language name and the color to use, and produces a beautiful map similar to Jishai's dadaviz map.
%macro do_map(language,color,outline); ods html anchor="&language"; proc sql noprint; select unique count(*) into :count separated by ' ' from my_data where upcase(language)=upcase("&language"); quit; run; goptions gunit=pct htitle=15 htext=3.6 ftitle="albany amt/bold" ftext="albany amt/bold" ctext=gray77; pattern1 v=s c=&color repeat=500; title1 ls=1.5 color=&color "&language"; title2 "is an official language in these &count countries..."; proc gmap data=my_data (where=(upcase(language)=upcase("&language"))) map=my_map all; id idname; choro idname / nolegend coutline=&outline cdefault=grayf5 cempty=grayf5 html=my_html des='' name="&name._&language"; run; %mend;
And then it was a simple matter of calling the macro 4 times - once for each language:
%do_map(ENGLISH,cx1976d2,cx4e9ce6); %do_map(FRENCH,cxe91e63,cxf672a0); %do_map(SPANISH,cxff5722,cxf9beac); %do_map(ARABIC,cx009688,cx39d8c7);
Below are static images of the SAS maps - click them to see the full-size interactive versions with html hover-text that show the country names. Note that each map also has a count of the number of countries speaking that language. I think this is a much easier way to make sense of the data, than the animation.
And I'll leave you with an ironic picture that my friend Jennifer took, of an Arabic sign :)