Hi All,
Many thanks for this great avenue. Using Stata14, I am am working on multiple country-specific surveys that measured household catastrophic expenditure at 10% and 40% of food and non-food expenditure. This two outcome variables is to be dis-aggregated by location (urban/rural), quintiles (n5). I am trying to reproduce a similar graph to the one attached for the 26 countries of interest. How do I reproduce this? What is the attached sample graph called?How can i combine two different datasets into one graph since I cannot merge the datasets.
I have attached the sample graph, the sample dataset for two countries. Below is my current code for a graph bar.
Any ideas on how to do this would be great
[graph bar cata_nf_40 cata_tot_10 [pw=popweight], over(hh_nexpcap_quintile, sort(cata_nf_40) descending label(labsize(medsmall))) ylabel(0(0.1).3)bar(1, color("7 111 106")) bar(2, color("196 252 245")) legend(label(1 "CATA40 non-food expenditure") label(2 "CATA10 total expenditure")) plotregion(color(white)) graphregion(fcolor(white) lcolor(black) ifcolor(white) ilpattern(solid)) ytitle("Proportion of CATA by wealth quintile", size(medsmall))title("CATA by wealth quintile", lpattern(solid) alignment(default) size(medium) color(black))
graph save cata_quintile, replace
graph bar cata_nf_40 cata_tot_10[pw=popweight], over(hh_urban,sort(cata_nf_40) descending label(labsize(medsmall)))ylabel(0(0.1)0.3)bar(1, color("7 111 106")) bar(2, color("196 252 245")) legend(label(1 "CATA40 non-food expenditure") label(2 "CATA10 total expenditure")) plotregion(color(white)) graphregion(fcolor(white) lcolor(black) ifcolor(white) ilpattern(solid)) ytitle("Proportion of CATA by location", size(medsmall))title("CATA by location", lpattern(solid) alignment(default) size(medium) color(black))
graph save cata_urban, replace
grc1leg cata_quintile.gph cata_urban.gph, rows(1) plotregion(color(white)) graphregion(fcolor(white) lcolor(black) ifcolor(white) ilpattern(solid)) title("Catastrophic health expenditure at 10% total and 40% non-food consumption expenditure", size(medium) lwidth(medthin) lpattern(solid) alignment(default) color(black))
graph save cata,replace][/CODE]
[* Example generated by -dataex-. To install: ssc install dataex
clear
input float popweight byte hh_region float hh_urban byte hh_nexpcap_quintile float(cata_tot_10 cata_nf_40)
2897.155 1 0 2 1 0
26074.395 1 0 1 0 0
2897.155 1 0 5 0 1
8691.465 1 0 3 0 0
5794.31 1 0 5 0 0
11588.62 1 0 2 0 0
12228.253 1 0 1 0 0
14485.775 1 0 5 0 0
20280.086 1 0 5 0 0
14485.775 1 0 2 0 0
17449.373 1 0 3 0 1
19942.14 1 0 4 0 0
22434.91 1 0 5 0 0
17449.373 1 0 3 0 0
22434.91 1 0 4 0 0
22434.91 1 0 4 0 0
22434.91 1 0 4 0 0
12463.838 1 0 2 0 0
14956.605 1 0 1 . .
4985.535 1 0 4 0 0
4057.28 1 1 1 0 0
5409.707 1 1 2 0 0
4057.28 1 1 5 0 0
5409.707 1 1 4 0 0
5409.707 1 1 5 0 0
5409.707 1 1 1 0 0
5409.707 1 1 4 0 0
8114.561 1 1 4 0 0
4057.28 1 1 4 0 1
1352.4268 1 1 4 0 0
4057.28 1 1 5 0 0
11915.287 1 0 1 0 0
19858.81 1 0 1 0 0
15887.05 1 0 1 0 0
7943.524 1 0 2 0 0
2336.3303 1 0 4 0 0
7943.524 1 0 1 0 0
23830.574 1 0 2 0 0
3971.762 1 0 1 0 0
15887.05 1 0 1 0 0
35745.86 1 0 1 0 0
27802.336 1 0 1 0 0
19609.8 1 0 2 0 0
39219.6 1 0 2 0 0
27453.72 1 0 2 0 0
19609.8 1 0 2 0 1
19609.8 1 0 3 0 0
9965.638 1 0 5 0 0
19609.8 1 0 3 0 0
11765.88 1 0 5 0 0
23531.76 1 0 2 0 0
6852.334 1 0 3 0 1
270.48685 1 0 2 0 0
27409.336 1 0 5 0 0
27409.336 1 0 2 0 0
17130.836 1 0 3 0 0
23983.17 1 0 1 0 0
20557 1 0 1 0 0
13704.668 1 0 2 0 0
27409.336 1 0 5 0 0
1352.4342 1 0 2 0 0
6852.334 1 0 3 0 0
4280.7036 1 1 5 0 0
4280.7036 1 1 5 0 0
25684.22 1 1 4 0 0
17122.814 1 1 3 0 0
8561.407 1 1 5 0 0
4280.7036 1 1 4 0 0
29964.926 1 1 3 0 0
12842.11 1 1 4 0 0
4280.7036 1 1 5 0 0
8561.407 1 1 4 1 1
4280.7036 1 1 5 0 0
12842.11 1 1 5 0 0
19922.89 1 0 2 0 0
6640.964 1 0 4 0 0
23243.373 1 0 1 0 0
33204.82 1 0 1 0 0
23243.373 1 0 1 0 0
3320.482 1 0 2 0 0
3320.482 1 0 4 0 0
19922.89 1 0 3 0 0
26563.855 1 0 2 0 0
9961.445 1 0 1 0 0
16602.41 1 0 1 0 0
3563.957 1 1 4 0 0
7127.914 1 1 5 0 0
12473.85 1 1 5 0 0
5345.935 1 1 5 0 0
12473.85 1 1 2 0 0
7127.914 1 1 4 1 1
8909.892 1 1 5 0 0
7127.914 1 1 5 0 0
5345.935 1 1 5 0 0
1781.9784 1 1 5 0 0
3563.957 1 1 4 0 0
1781.9784 1 1 5 0 0
24911.64 1 0 1 0 0
28470.45 1 0 2 0 0
3558.806 1 0 4 0 0
end
label values hh_region HH_SAQ01
label def HH_SAQ01 1 "Tigray", modify
label values hh_nexpcap_quintile hh_nexpcap_quintile
label def hh_nexpcap_quintile 1 "poorest", modify
label def hh_nexpcap_quintile 2 "poorer", modify
label def hh_nexpcap_quintile 3 "middle", modify
label def hh_nexpcap_quintile 4 "richer", modify
label def hh_nexpcap_quintile 5 "richest", modify
CODE]
Many thanks for this great avenue. Using Stata14, I am am working on multiple country-specific surveys that measured household catastrophic expenditure at 10% and 40% of food and non-food expenditure. This two outcome variables is to be dis-aggregated by location (urban/rural), quintiles (n5). I am trying to reproduce a similar graph to the one attached for the 26 countries of interest. How do I reproduce this? What is the attached sample graph called?How can i combine two different datasets into one graph since I cannot merge the datasets.
I have attached the sample graph, the sample dataset for two countries. Below is my current code for a graph bar.
Any ideas on how to do this would be great
[graph bar cata_nf_40 cata_tot_10 [pw=popweight], over(hh_nexpcap_quintile, sort(cata_nf_40) descending label(labsize(medsmall))) ylabel(0(0.1).3)bar(1, color("7 111 106")) bar(2, color("196 252 245")) legend(label(1 "CATA40 non-food expenditure") label(2 "CATA10 total expenditure")) plotregion(color(white)) graphregion(fcolor(white) lcolor(black) ifcolor(white) ilpattern(solid)) ytitle("Proportion of CATA by wealth quintile", size(medsmall))title("CATA by wealth quintile", lpattern(solid) alignment(default) size(medium) color(black))
graph save cata_quintile, replace
graph bar cata_nf_40 cata_tot_10[pw=popweight], over(hh_urban,sort(cata_nf_40) descending label(labsize(medsmall)))ylabel(0(0.1)0.3)bar(1, color("7 111 106")) bar(2, color("196 252 245")) legend(label(1 "CATA40 non-food expenditure") label(2 "CATA10 total expenditure")) plotregion(color(white)) graphregion(fcolor(white) lcolor(black) ifcolor(white) ilpattern(solid)) ytitle("Proportion of CATA by location", size(medsmall))title("CATA by location", lpattern(solid) alignment(default) size(medium) color(black))
graph save cata_urban, replace
grc1leg cata_quintile.gph cata_urban.gph, rows(1) plotregion(color(white)) graphregion(fcolor(white) lcolor(black) ifcolor(white) ilpattern(solid)) title("Catastrophic health expenditure at 10% total and 40% non-food consumption expenditure", size(medium) lwidth(medthin) lpattern(solid) alignment(default) color(black))
graph save cata,replace][/CODE]
[* Example generated by -dataex-. To install: ssc install dataex
clear
input float popweight byte hh_region float hh_urban byte hh_nexpcap_quintile float(cata_tot_10 cata_nf_40)
2897.155 1 0 2 1 0
26074.395 1 0 1 0 0
2897.155 1 0 5 0 1
8691.465 1 0 3 0 0
5794.31 1 0 5 0 0
11588.62 1 0 2 0 0
12228.253 1 0 1 0 0
14485.775 1 0 5 0 0
20280.086 1 0 5 0 0
14485.775 1 0 2 0 0
17449.373 1 0 3 0 1
19942.14 1 0 4 0 0
22434.91 1 0 5 0 0
17449.373 1 0 3 0 0
22434.91 1 0 4 0 0
22434.91 1 0 4 0 0
22434.91 1 0 4 0 0
12463.838 1 0 2 0 0
14956.605 1 0 1 . .
4985.535 1 0 4 0 0
4057.28 1 1 1 0 0
5409.707 1 1 2 0 0
4057.28 1 1 5 0 0
5409.707 1 1 4 0 0
5409.707 1 1 5 0 0
5409.707 1 1 1 0 0
5409.707 1 1 4 0 0
8114.561 1 1 4 0 0
4057.28 1 1 4 0 1
1352.4268 1 1 4 0 0
4057.28 1 1 5 0 0
11915.287 1 0 1 0 0
19858.81 1 0 1 0 0
15887.05 1 0 1 0 0
7943.524 1 0 2 0 0
2336.3303 1 0 4 0 0
7943.524 1 0 1 0 0
23830.574 1 0 2 0 0
3971.762 1 0 1 0 0
15887.05 1 0 1 0 0
35745.86 1 0 1 0 0
27802.336 1 0 1 0 0
19609.8 1 0 2 0 0
39219.6 1 0 2 0 0
27453.72 1 0 2 0 0
19609.8 1 0 2 0 1
19609.8 1 0 3 0 0
9965.638 1 0 5 0 0
19609.8 1 0 3 0 0
11765.88 1 0 5 0 0
23531.76 1 0 2 0 0
6852.334 1 0 3 0 1
270.48685 1 0 2 0 0
27409.336 1 0 5 0 0
27409.336 1 0 2 0 0
17130.836 1 0 3 0 0
23983.17 1 0 1 0 0
20557 1 0 1 0 0
13704.668 1 0 2 0 0
27409.336 1 0 5 0 0
1352.4342 1 0 2 0 0
6852.334 1 0 3 0 0
4280.7036 1 1 5 0 0
4280.7036 1 1 5 0 0
25684.22 1 1 4 0 0
17122.814 1 1 3 0 0
8561.407 1 1 5 0 0
4280.7036 1 1 4 0 0
29964.926 1 1 3 0 0
12842.11 1 1 4 0 0
4280.7036 1 1 5 0 0
8561.407 1 1 4 1 1
4280.7036 1 1 5 0 0
12842.11 1 1 5 0 0
19922.89 1 0 2 0 0
6640.964 1 0 4 0 0
23243.373 1 0 1 0 0
33204.82 1 0 1 0 0
23243.373 1 0 1 0 0
3320.482 1 0 2 0 0
3320.482 1 0 4 0 0
19922.89 1 0 3 0 0
26563.855 1 0 2 0 0
9961.445 1 0 1 0 0
16602.41 1 0 1 0 0
3563.957 1 1 4 0 0
7127.914 1 1 5 0 0
12473.85 1 1 5 0 0
5345.935 1 1 5 0 0
12473.85 1 1 2 0 0
7127.914 1 1 4 1 1
8909.892 1 1 5 0 0
7127.914 1 1 5 0 0
5345.935 1 1 5 0 0
1781.9784 1 1 5 0 0
3563.957 1 1 4 0 0
1781.9784 1 1 5 0 0
24911.64 1 0 1 0 0
28470.45 1 0 2 0 0
3558.806 1 0 4 0 0
end
label values hh_region HH_SAQ01
label def HH_SAQ01 1 "Tigray", modify
label values hh_nexpcap_quintile hh_nexpcap_quintile
label def hh_nexpcap_quintile 1 "poorest", modify
label def hh_nexpcap_quintile 2 "poorer", modify
label def hh_nexpcap_quintile 3 "middle", modify
label def hh_nexpcap_quintile 4 "richer", modify
label def hh_nexpcap_quintile 5 "richest", modify
CODE]
Comment