Hi everyone,
I would like to use calibrated design weights for my descriptive analysis. However, I'm not able to include the weight command with the histogram command.
This is the code for creating the histogram:
Has anyone an idea how i can create a weighted histogram?
Thanks in advance.
Emily
I would like to use calibrated design weights for my descriptive analysis. However, I'm not able to include the weight command with the histogram command.
This is the code for creating the histogram:
Code:
#egen rel_sex=group(sex religion) tab rel_sex table religion sex rel_sex lab def rel_sex 1 "Männlich: Christlich" 2 "Muslimisch" 3 "Andere" 4 "Keine" /// 5 "Weiblich: Christlich" 6 "Muslimisch" 7 "Andere" 8 "Keine" lab value rel_sex rel_sex tab religion sex fre rel_sex tab rel_sex if att!=. forvalues i=1/8 { sum rel_sex if rel_sex==`i' & att!=. local n`i' = r(N) } histogram att, by(rel_sex, row(2) title("Verteilung der physischen Attraktivität, erste Welle: Religionszugehörigkeit" " ") /// note(`"{bf:Männlich}: Christlich N = `n1', Muslimisch N = `n2', Andere N = `n3', Keine N = `n4'"' /// `"{bf:Weiblich}: Christlich N = `n5', Muslimisch N = `n6', Andere N = `n7', Keine N = `n8'"' /// , size(vsmall)) legend(off)) /// percent discrete name(rel_hist, replace) /// addlabel addlabopts(mlabposition(12) mlabformat(%4.1f) mlabsize(vsmall)) /// yscale(r(0(10)40)) xscale(r(1(1)7)) /// xlabel(1 "Sehr unattraktiv" 2 3 4 5 6 7 "Sehr attraktiv", angle(45)) /// xtitle("Physische Attraktivität" " ") /// scheme(plotplainblind) graph save "text\tables\rel_hist.gph", replace graph export "text\tables\rel_hist.emf", replace as(emf) graph export "text\tables\rel_hist.png", replace as(png)
Thanks in advance.
Emily