Hello,
I am trying to sort gender across different categories but I want the data sorted based on prespecified order. Currently, STATA is ordering the graphs based on the values on area variable(From 1 to 5). I want to order them in a way that if the gender ratio is similar then it is next to each other, and then increases based on the higher number of males or females in the next area.
------------------ copy up to and including the previous line ------------------
I am currently running the following code:
I also want to inquire if I could write a code to have all the graphs in a single row. I know that it can be done in the graph editor but having a code for it would be quite helpful as well. If you could also guide as to how I could show the number of observations using blabel as well as how I could show the total observations of each area using coding. Thank you
I am trying to sort gender across different categories but I want the data sorted based on prespecified order. Currently, STATA is ordering the graphs based on the values on area variable(From 1 to 5). I want to order them in a way that if the gender ratio is similar then it is next to each other, and then increases based on the higher number of males or females in the next area.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(sex area) 1 2 1 4 1 3 1 1 1 2 1 4 1 1 1 5 1 2 0 4 end label values sex sex label def sex 0 "Female", modify label def sex 1 "Male", modify
I am currently running the following code:
Code:
graph bar (percent), over(sex, sort(#)) by(area) asyvars
I also want to inquire if I could write a code to have all the graphs in a single row. I know that it can be done in the graph editor but having a code for it would be quite helpful as well. If you could also guide as to how I could show the number of observations using blabel as well as how I could show the total observations of each area using coding. Thank you
Comment