-
Login or Register
- Log in with
// open example data set scheme s1mono frame reset sysuse nlsw88, clear // do some initial preparation gen byte urban = c_city + smsa label define urban 2 "central city" /// 1 "suburban" /// 0 "rural" label value urban urban label variable urban "urbanicity" // copy the data to another frame because the changes we are going to make now // are only relevant for a graph and we want to go back afterwards frame copy default tograph frame change tograph // make a dataset with mean wages for every type of place of residence collapse (mean) wage, by(urban) // determine how the mean wage is going to be displayed format wage %9.2f // make the graph twoway bar wage urban, /// barw(.8) xlabel(0/2, val) xtitle("") /// ylabel(0(2)10, format(%9.0g) angle(0)) || /// scatter wage urban, /// msymbol(i) mlabel(wage) mlabpos(12) legend(off) // go back to the original data frame change default
* Example generated by -dataex-. For more info, type help dataex clear input str7 countries float remittance "Algeria" 2 "Egypt" 20.4 "Gaza" 2.3 "Iran" 1.3 "Jordan" 3.8 "Lebanon" 7.5 "Morocco" 6.7 "Syria" 1.6 "Tunisia" 2.3 "Yemen" 3.4 end label var remittance "remittance ???? (billion $)" set scheme s1color graph hbar (asis) remittance, over(countries, sort(1) descending) bar(1, fcolor(blue*0.2) lcolor(blue)) ysc(alt) blabel(total) ysc(r(. 22))
su remittance, meanonly graph hbar (asis) remittance, over(countries, sort(1) descending) bar(1, fcolor(blue*0.2) lcolor(blue)) ysc(alt) blabel(total) ysc(r(. 22)) yli(`r(mean)')
Comment