Dear All,
It must be something simple but I couldn't find any help on web. I wanted to know whether it is possible to generate a sex ratio variable which when used can give the sex ratio by area and by different district in a table.
For example If I use the following syntax I can only get the sex ratio by Area
egen male=(sex==1) , by(area)
egen female=(sex==2), by(area)
gen sexratio=male/female
So if I want by District I have to generate a new variable. I want to know whether its is possible to generate a sex ratio variable which can used in generating a table of sex ratio by Area and District with one variable of sex ratio instead of having to generate new variables for each level (Area and District)
Thank you
It must be something simple but I couldn't find any help on web. I wanted to know whether it is possible to generate a sex ratio variable which when used can give the sex ratio by area and by different district in a table.
For example If I use the following syntax I can only get the sex ratio by Area
egen male=(sex==1) , by(area)
egen female=(sex==2), by(area)
gen sexratio=male/female
So if I want by District I have to generate a new variable. I want to know whether its is possible to generate a sex ratio variable which can used in generating a table of sex ratio by Area and District with one variable of sex ratio instead of having to generate new variables for each level (Area and District)
Thank you
Comment