Hi Statalisters,
I find myself frequently a bit stuck with Stata's deep graphing capacity. I am attempting to graph the prevalence of a condition (positive result for a Lassa fever ELISA test) by study village. I have data from around 8100 residents of rural Sierra Leone, and would like to show a bar graph of these values by village (n=26), but I'd also like to sort the villages into administrative districts (n=3). Each village should appear once and only once, within its respective district (which is not happening, see below). Within each administrative district, I may wish to sort villages - perhaps by prevalence (e.g., ascending), but I am not yet sure I want to do this, and I can't seem to get Stata to do much of these tasks for me. I'm attaching my data, and a few examples of my resultant graphs. Could someone help me:
1. Sort the villages by administrative district. Each village should appear on the graph only once.
2. Within each administrative district, sort the villages by prevalence
3. Bonus question: how would you get Stata to show the prevalence proportion as a percentage? (i.e., 0.6 should be 60%)
I find myself frequently a bit stuck with Stata's deep graphing capacity. I am attempting to graph the prevalence of a condition (positive result for a Lassa fever ELISA test) by study village. I have data from around 8100 residents of rural Sierra Leone, and would like to show a bar graph of these values by village (n=26), but I'd also like to sort the villages into administrative districts (n=3). Each village should appear once and only once, within its respective district (which is not happening, see below). Within each administrative district, I may wish to sort villages - perhaps by prevalence (e.g., ascending), but I am not yet sure I want to do this, and I can't seem to get Stata to do much of these tasks for me. I'm attaching my data, and a few examples of my resultant graphs. Could someone help me:
1. Sort the villages by administrative district. Each village should appear on the graph only once.
2. Within each administrative district, sort the villages by prevalence
3. Bonus question: how would you get Stata to show the prevalence proportion as a percentage? (i.e., 0.6 should be 60%)
Code:
graph hbar bl_serostatus_astmh, over(village_astmh) over(districtp) ytitle("LASV prevalence (probability)") saving(example_graph) graph export example_graph.png, replace
Comment