Search code examples
graphstata

Bar Graph with Confidence Interval levels


I have a dataset and I have been able to create bar graphs with confidence intervals on them. The code I have used is follows:

statsby mean_ck=r(mean) upper=r(ub) lower=r(lb), by(urban_rural) clear : ci mean content_knowledge
format mean_ck %9.3g

twoway (bar mean_ck urban_rural, barwidth(0.5)) ///
       (rcap lower upper urban_rural) ///
       (scatter mean_ck urban_rural, msymbol(none) mlabel(mean_ck) mlabposition(1)), ///
       legend(off) ytitle("Content Knowledge of Teachers") xtitle("Location")

Here, content_knowledge is different for all obs and urban_rural has two values: 0 "Urban" and 1 "Rural". However the xaxis of the graph is showing a mean over 0 and 1. Is there a way to have x axis correspond only to 0 and 1 as urban and rural?

Thanks

graph


Solution

  • See the help for axis label options.

    You need an extra option something like

    xla(0 “Urban” 1 “Rural”)