QQ Plot1

Quantile-quantile plot by contrasting Eurozone to non-Eurozone EU jurisdictions. Special coding features include the separation of a variable to two vectors based on a binary response, assigning value lables for use as axes labels, and the use a macro extension function for extracting a variable label to be used as a subtitle.

qqplot1

Code

#delimit ;

use http://meafa3.econ.usyd.edu.au/dta/eu_ni, clear ;

generate tl = ta-te ;
generate ni2tl = ni/tl ;
label variable ni2tl "Net Income / Total Liabilities" ;
local subtit : variable label ni2tl ;

generate mzone = (!inlist(country,"DNK","SWE","GBR")) ;
label variable mzone "Monetary zone" ;
label define mzone 1 "Eurozone" 0 "EU, non-Eurozone" ;
label value mzone mzone ;
separate ni2tl if sic1==6, by(mzone) gen(mzone_) ;
label variable mzone_1 "Eurozone" ;
label variable mzone_0 "EU, non-Eurozone" ;

qqplot mzone_1 mzone_0 if inrange(ni2tl,-1,1),
      msymbol(oh)
      subtitle("`subtit'")
      ylabel(-1 0 1)
      xlabel(-1 0 1)
      aspect(1)
      scheme(s2color)
      saving(mzone.gph, replace) ;

 graph export mzone.pdf, replace ;