Announcement

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

  • Merging variables

    Hi everyone,

    Newish Stata user here with a question.

    I have one variable that captures two responses...."weeks" or "months". I have a second variable that captures the numbers associated with the weeks or months. I want to merge these variables together so that I can see which numbers match up with "weeks" or "months". I hope this makes sense......for instance, the codebook shows:

    -----How many (blank) weeks or (blank) months ...... 1=weeks, 2=months (variable 1)
    -----number associated with previous questions (variable 2)


    THanks!

  • #2
    This is truly unfortunate question design, because a month is not a consistent number of weeks. Probably the best you can salvage from the situation is to rely on the fact that the average month is 13/3 weeks.

    Code:
    gen duration_in_weeks =variable2 * cond(variable1 == 1, 1, 13/3)

    Comment


    • #3
      I'm use state data and I'm not sure why the question is designed this way but, I agree. Not ideal! I will try this out and see what happens. Thanks so much!

      Comment

      Working...
      X