Announcement

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

  • Question on how to create a dummy variable for a panel data set

    Hi,
    This is an excerpt from my data set. I would like to create a dummy variable for agemon (age in months) separately for each round and study its cross-sectional effect. For example, I want to create an age variable for round 3 only by categorizing age into two cohorts. What would be the command for that? Kindly help.
    childid round agemon
    IN010001 1 6
    IN010001 2 69
    IN010001 3 100
    IN010001 4 149
    IN010001 5 185
    IN010002 1 15
    IN010002 2 67
    IN010002 3 98
    IN010002 4 146
    IN010002 5 183
    IN010003 1 11
    IN010003 2 63
    IN010003 3 94
    IN010003 4 143
    IN010003 5 179


  • #2
    Are you using YLS data?

    Try
    Code:
     tab agemon if round==3, gen(agedm)
    Best regards,
    Mukesh

    Comment


    • #3
      What two age cohorts? Same for all rounds?

      Comment


      • #4
        Originally posted by Mukesh Punia View Post
        Are you using YLS data?

        Try
        Code:
         tab agemon if round==3, gen(agedm)
        Yes I am using YLS data

        Comment


        • #5
          Yes the cohort limit would change for all rounds but the mechanism stays the same. E.g., in Round 1 the min agemon in 6 and max is 12. So the cohort would be age=0 if agemon is 6-9 and age = 1 if agemon is 10-12

          Comment


          • #6
            but what if the agemon is different in another round? how do you cut it then? are you splitting at the mean?

            Comment


            • #7
              Yes, at the mean

              Comment


              • #8
                Code:
                egen agecut = mean(agemon), by(round)
                egen agecohort = agemon > agecut

                Comment

                Working...
                X