use "ZA4582_v1-0-0.dta", clear
recode v151 (9 = .a "No response") ///
(8 = .b "Don't know") ///
(7 = .c "Refused") ///
(6 = .d "None of the strata") ///
(5 = 1 "Upper class") ///
(4 = 2 "Upper middle class") ///
(3 = 3 "Middle class") ///
(2 = 4 "Working class") ///
(1 = 5 "Lower class") ///
, gen(subjclass)
label var subjclass "Subjective social class"
generate nolabelyear = year
label define ost_west 1 "Western Germany" 2 "Eastern Germany", modify
graph bar (count), over(subjclass, descending) ///
over(nolabelyear, label(angle(vertical))) ///
by(ost_west, note("{it:Source:} German General Social Survey (Allbus), doi: 10.4232/1.12439.", span) col(1)) ///
percent stack asyvars ytitle(%) ysize(8) ///
legend(rows(3) colfirst) name(figure1, replace)
tabplot subjclass nolabelyear, by(ost_west, ///
note("{it:Source:} German General Social Survey (Allbus), doi: 10.4232/1.12439.", span)) ///
percent(ost_west nolabelyear) ///
showval(mlabsize(tiny)) xtitle("") ///
xlabel(, angle(vertical)) name(figure2, replace)
May 24, 2017
Random graphs (95): Categorical variables
Labels:
Allbus,
graph bar,
Random graphs,
tabplot

