Jun 20, 2017

Random graphs (100): Labeling lines directly

import delimited une_rt_a_1_Data.csv, clear

/*
DATASET: Unemployment by sex and age - annual average [une_rt_a]
LAST UPDATE: 14.06.17 13:10:19
EXTRACTION DATE: 18.06.17 11:35:33
SOURCE OF DATA: Eurostat
*/

drop sex age unit flagandfootnotes

// Generate country variable
kountryadd "Germany (until 1990 former territory of the FRG)" to "Germany" add
kountry geo, from(other) stuck marker
ren _ISO3N_ country
kountry  country, from(iso3n) to(iso2c)
ren  _ISO2C_ country_str
replace country_str = "UK" if country_str == "GB"
list country_str geo

// Fix unemployment rate
replace value = "" if value == ":"          // Fix missing data indicator 
destring value, replace                     // Convert to numeric

twoway (line value time if country_str == "UK") ///
       (line value time if country_str == "US") ///
       (scatteri 4 2016 "United States" 3.5 2016 "United Kingdom", msymbol(none)) ///
      , legend(off) ///
        xtitle("") ytitle("Male unemployment rate, 25-74 y.") ///
        xlabel(1985(5)2015) ///
        xscale(range(1983 2023)) ///
        note(" " "{it: Source:} Eurostat, une_rt_a, date of extraction: 2017-06-18", span)