Announcement

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

  • Creating a variable measuring proportion for categorical variable

    Hello, everyone. I am estimating the effect of parenting styles on child outcomes and I am trying to use the proportion of parents' parenting styles of other students in the same class as the instrumental variable. The data is a class-based survey with students nested within classes. The variable parenting styles is a categorical variable. I don't know how to generate a variable measuring proportion of parenting styles for other students in the same class. Any suggestions would be greatly appreciated.

  • #2
    In general, a proportion can be calculated as the mean of a zero-one indicator variable. So,


    Code:
    sysuse auto, clear 
    egen pr_foreign = mean(foreign), by(rep78)
    That should carry over to your problem (no data example) if and only if there are two distinct parenting styles. Otherwise I can't follow what you want. If there are three or more styles, I don't see how that can be reduced to a single variable.

    Comment


    • #3
      Hi Nick, Thank you very much for your reply. Very helpful.

      Comment

      Working...
      X