Apr 26, 2016

Random graphs (75): Line plots

use essround cntry netuse dweight using ESS1-6e01_0_F1.dta, clear

// Drop parts of data and label wave identifier
drop if essround == 6 // Doesn't have internet use variable
drop if inlist(cntry, "IS", "LT") // drop countries with only one measurement
label define essround 1 "2002" 2 "2004" 3 "2006" 4 "2008" 5 "2010"
label val essround essround 

// Generate variable of interest
generate dailyuser = (netuse == 7) if !missing(netuse)

// Generate values by country and round
collapse (mean) dailyuser [pweight = dweight], by(cntry essround)
replace dailyuser = dailyuser * 100

// Generate country identifier
kountry cntry, from(iso2c)
rename NAMES_STD country

// Plot
twoway (connected dailyuser essround, ///
        by(country, note(" " "{it:Source:} European Social Survey, rounds 1{c 150}5, weighted data", span size(*.8)) ///
     col(3))), xlabel(, val) ytitle("% daily internet users") ysize(8) xtitle("")