Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating sex ratio

    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

  • #2
    Andrew:
    I'm not sure I've understood what you're after:notwithstanding I would take a look at the -group- function available from -egen-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      For example if i want the sex ration by District and area in one table how I can do that

      Comment

      Working...
      X