Announcement

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

  • Combining dummy variables on Stata

    I have two dummy variables d1 which takes the values 1,2,3,4 and d2 which takes the values 1,2,3,..,9. I wish to create a new variable which takes the value 1 if d1 is 2,3 or 4 and d2 is 8 or 9, and the value 2 otherwise. How do I do this on Stata?

  • #2
    Code:
    gen new_var = 2
    replace new_var = 1 if inlist(d1, 2, 3, 4) & inlist(d2, 8, 9)

    Comment


    • #3
      Hi. I have 6 dummy variables and would like to combine them into one variable. However, for one respondent, there are several cases of 1s in the same row. How do I deal with my issue?

      Thanks

      Comment

      Working...
      X