Announcement

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

  • generating round variable

    Hi!

    I am working on a data set that includes 10 rounds. It does not have a specific round/time info, but it has interview_r1, interview_r2, ...interview_r10 for those households interviewed in those rounds(1.Yes, 0.No). I was wondering if any chance to generate a variable to show round to include in the analysis that I can cover changes over time. When I try something like gen round=1 if interview_r1==1, replace round=2 if interview_r2==1, it turns out weird as same households are cover in different rounds. It looks as below.

    household_id interview_r1 interview_r2 interview_r3 interview_r4 interview_r5
    010101088800910007
    010101088800910017 1. YES 1. YES 1. YES 1. YES
    010101088800910026
    010101088800910029 1. YES 1. YES 1. YES
    010101088800910038
    010101088800910046
    010101088800910054 1. YES 1. YES 1. YES
    010101088800910062
    010101088800910070
    010101088800910082 1. YES 1. YES 1. YES 1. YES 1. YES
    010101088800910093 1. YES 1. YES 1. YES
    010102088801010034 1. YES 1. YES
    010102088801010035 1. YES 1. YES 1. YES 1. YES 1. YES
    010102088801010048 1. YES 1. YES 1. YES
    010102088801010068
    010102088801010090 1. YES 1. YES 1. YES 1. YES 1. YES
    010102088801010104 1. YES 1. YES 1. YES 1. YES 1. YES
    010102088801010113 1. YES 1. YES 1. YES 1. YES 1. YES
    010102088801010136
    010102088801010148 1. YES 1. YES 1. YES 1. YES 1. YES
    010102088801010161
    010102088801010173 1. YES 1. YES 1. YES 1. YES 1. YES
    010103088800709008
    010103088800709016
    010103088800709024
    010103088800709032
    010103088800709040
    010103088800709048
    010103088800709056 1. YES 1. YES 1. YES 1. YES 1. YES
    010103088800709064
    010103088800709072 1. YES 1. YES 1. YES 1. YES 1. YES
    010103088800709080
    010104010100101012
    010104010100101028 1. YES 1. YES 1. YES 1. YES 1. YES
    010104010100101044 1. YES 1. YES 1. YES 1. YES 1. YES
    010104010100101060 1. YES 1. YES 1. YES 1. YES 1. YES
    010104010100101076 1. YES 1. YES 1. YES 1. YES 1. YES


    Beside, some variables given for specific round (e.g. number of female_r1, number of female_r2..). In the analysis should I add them seperately as given, or an alternative and more practical way exists?

    Thank you in advance!
    Last edited by Esra KKocag; 08 Mar 2023, 23:23.

  • #2
    Esra:
    most of your problems can be fixed via -reshape- from -wide- to -long- and replacing -string- with numerical variables.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you Carlo for your response.
      I will try
      Last edited by Esra KKocag; 10 Mar 2023, 00:33.

      Comment

      Working...
      X