Have you ever had one of those moments when something you had assumed was true all your life, turned out not to be true? I remember that happening in my high school Spanish class (taught by the wonderful Señor Shoaf), when he let us in on a little secret - the names that we call countries are not always the same as what they call themselves. For example, people in Spain call their country España. My mind was immediately blown, and my world view became a whole lot bigger!
Therefore when I saw the following map on Reddit, it caught my attention and brought back great memories from that high school moment.
It was an interesting map, but I had a few ideas for enhancements. What about adding mouse-over text with the English version of the country names. And what letting the user click on the country to hear the name pronounced!
Getting The Real Country Names
How do I write SAS code to handle these special characters in a map? Well, there are probably several ways to do this, but I chose brute force, with numeric hex codes, and Unicode.
For the country names with special characters, I first looked them up in Wikipedia, where I could copy-n-paste the special characters (since I couldn't copy-n-paste them from the map jpg image in Reddit). Here's an example of Russia, with the real name highlighted and ready to copy-n-paste:
I then copy-n-pasted the name into a web page that would tell me the hex codes for the Unicode characters.
Next, I saved the hex codes in my SAS program like this. Notice that SAS needs 4 hex digits per character, therefore I pad 0's on the left where needed (for example '420' from the table above becomes '0420' in my SAS code below):
I then use the following code to annotate the country name text on the map, in SAS/Graph. Notice I specify '/unicode' after the font name.
And here is what my map looks like, with the country names annotated:
Making the Map Interactive
And now, what about those extra features I wanted to add, to make my map more functional than the one in Reddit? ... How do I get the computer to pronounce the country names? First I copy-n-paste the country name into the forvo page's search box. This takes me to a page that provides one (or more) pronunciations, where I can click the 'play' button to hear them.
I then copy-n-paste the url (from the above page), and save it in a pronunciation_link variable in my SAS annotate dataset. I also add a country_us variable showing what we call the country in the US (in this case, 'Russia').
Now that I have the desired drill-down (pronunciation_link), and mouse-over text (country_us), all I have to do is encode them with the appropriate HTML tags (title= and href=) in a variable called 'html'.
Now, when I hover my mouse over Russia, it has mouse-over text that shows me what we call it in English (Russia), and when you click on it, it drills-down to the page with the pronunciation(s). Click here (or click my map above) to see the interactive version, with the mouse-over text and drill-downs to the pronunciations.
Hopefully you've learned some tricks to help annotate special characters in your SAS/Graphs, and hopefully you'll enjoy seeing (and hearing!) the real country names in my map! Here is a link to my complete SAS code, if you'd like to see all the details, and experiment with it.
Just for Fun
If you made it this far, you now deserve a little fun! Here's a photo my friend Mark took during one of his motorcycle trips around Europe. Can you use my map, and find this country name, and mouse-over the country to see the English name? If you figure out which country it is, leave your answer in a comment below!
I know this is a bit picky, but in Belgium they call their country by 2 different names: Belgie (Flemish) and Belgique (French). While working in Brussels I witnessed riots when the 2 regions and languages, Flanders (Flemish) and Wallonia (French), were not equally represented.
Ahh - good to know! Perhaps I should make an 'enhancement' to the map! 🙂
Thanks for an interesting blog Robert. Your map is great! The picture is easy for a native Finn living in Suomi. This is the border between Ruotsi and Suomi up in the North in Lapland. The village is called Karesuando on the Swedish side of the river and on the Finnish side it is Kaaresuvanto or Karesuvanto. The indigenous Sami people call it Karesuanto, Gárasavvon or Karasavvon. Places well worth visiting, welcome!
Wow - I think we've found a SME (subject matter expert)! 🙂
The country is Sweden, but then I'm Norwegian and born 15 km from the Swedish border.
There is actually a lot of countries in Europe that has several name. Norway for instance has Norge (90 % of the population) Noreg ( basically a different dialect of Norwegian but an offical writing form) and Norga or Vuodna in Sami (the language of the Sami People < 1 % of the poulation). Switzer land with 4 offical languages has: Language Official Name
German* Schweizerische Eidgenossenschaft
French* Confédération Suisse
Italian* Confederazione Svizzera
Rumantsch* Confederaziun Svizzer
So there will be quite a lot of work. The example is really good in what can be achieved with real programming and graphs/ maps.
Another thought what about USA. As you have no offical language what is the offical name?
Hmm ... maybe I should show the most popular name on the map, and then show alternate names (with %'s) in the mouse-over text!
No one in Switzerland would call the country "Confoederatio Helvetica", which is the official Latin name. Depending on what language you speak, it's either "Schweiz", "Suisse", "Svizzera" or "Svizzer". The "Confederation" part is never said unless it's an official document. And, because our German is a dialect and not the official "High" German, when spoken, Swiss Germans wouldn't say "Schweiz", but rather "Schwiiz".
Interesting! That's a lot of names/variations to choose from!
Ahhhhh Sverige! Having been there for the first time a few months ago I recognize the Swedish name for Sweden. https://twitter.com/HomesAtMetacoda/status/1106910480549842945
Lovely story from your high school days and also using hex codes!
Apparently you've been *everywhere* ... probably most places more than once! 😉
And the tiny minority of German-speaking Belgians call their country Belgien.
I think you'll find that the name of the country to the north of Greece is no longer just Macedonia. This has been a long-running argument. Both claim Alexander the Great....
Thanks for opening this can of worms!
Ahh! - Good discussion!
Made me chuckle when you mentioned "special characters" and gave a whole different script (Cyrillic) as an example. Good thing people in these parts of the world aren't easily offended by those little lapses. 🙂
Greetings from an ex iso-8859-2 user!
This is a wonderful project. I have pondered why we "Anglicize" other countries' names, and how this small but significant habit contributes to world aggression. I mean, if people you met constantly called you their version of what they name you rather than what you call yourself, I'd imagine it would be quite annoying - now times that a billion LOL
Have, or will you, create a world map like this? I'd love to see it!