Showing posts with label import excel. Show all posts
Showing posts with label import excel. Show all posts

Jan 13, 2015

Random graphs (44): Small-multiples line plots

import excel "no of embryos transferred.xlsx", sheet("Tabelle1") firstrow clear

reshape long tot e1a e1p e2a e2p e3a e3p e4a e4p, i(country) j(year)

kountry country, from(other) stuck
ren _ISO3N_ ctry
kountry ctry, from(iso3n) to(iso2c)
drop ctry
ren _ISO2C_ cntry
replace cntry = "UK" if cntry == "GB"

order country cntry year tot e1a e2a e3a e4a e1p e2p e3p e4p
drop if cntry == "CY" | cntry == "EE" | cntry == "NL"
drop if cntry == "AL" | cntry == "BA" | cntry == "HR"
drop if cntry == "KZ" | cntry == "MD" | cntry == "RO"
drop if cntry == "UA" | cntry == "RS" | cntry == "TR"
drop if cntry == "ME" 

twoway (line e1p year, by(cntry, note("")) cmissing(no) lwidth(thick)) ///
       (line e2p e3p e4p year, by(cntry, note("{it:Sources:} ESHRE EIM reports, {it:Human Reproduction} 2001{c 150}2014", span)) cmissing(no)) ///
       , xlabel(1997 2000 2005 2010, ang(h)) xtitle("") ytitle("% of all transfers") ///
  legend(label(1 "1 embryo")  label(2 "2 embryos") ///
         label(3 "3 embryos") label(4 "4+ embryos") row(1)) 

Dec 8, 2014

Random graphs (38): Line graph with two y-axes

import excel "Figure 3.xlsx", sheet("Figure 3") cellrange(A3:E118) firstrow case(lower) clear

rename anne year
rename agemoyenlamaternitfrance afb
rename tauxdegmellitfrance twin

label var year "Year"
label var afb  "Mean age at childbearing"
label var twin "Twin deliveries per 1,000 deliveries"
    
twoway (line afb year) ///
       (line twin year, yaxis(2)) ///
      , xlabel(1900 1925 1950 1975 2000 2013) ///       
        xtitle("Year") ylabel(, format(%6.0f) axis(2)) ///
        legend(pos(7) ring(0)) ytitle("Age in years") ///       
        ytitle("Twin deliveries per 1,000 deliveries", axis(2)) ///
        caption("{it:Source:} Pison {it:et al.} (2004), {it:Population}, doi: 10.2307/3654895", span)