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
Related Posts with Calculating sex ratio
Creating a variable that identifies and calculates overlapping time periodsHi everyone, I am currently working on data that shows if respondents of a survey worked part time …
strpos function not foundwhen I even I put this command I get this result . gen has_x= strpos (ICD , "X") >0 strpos not f…
Kaplan Meier risk table problemDear Statalist, I am using Stata 14.2 on Mac. I have created a propensity score IPT weighted sample…
Testing coefficient difference in 2 probit modelsI would like to test the significance of difference between the coefficients in 2 probit models. I f…
Using a loop to compare observations of a variableHi All, I have a dataset which looks something like below: ID Amount month max_amount max_month N…
Subscribe to:
Post Comments (Atom)
0 Response to Calculating sex ratio
Post a Comment