Announcement

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

  • Impute Age if Observation Missing in Long Dataset

    My dataset looks as follows:
    ID wave Age male
    1234 1 47 1
    1234 2 49 1
    1234 3 . 1
    1234 4 53 1
    1234 5 55 1
    Because respondent 1234 has not responded to wave 3, the age variable is missing. I am interested in which wave individual 1234 has become eligible for a program (by turning 50). Hence, I would like to impute these values. I am considering using a for-loop, but am not sure if this operation is possible in a long format of the data.

  • #2
    The example data you show suggests that the waves are spaced exactly two years apart. If that is the case, the -ipolate- command will fill in things for you. See -help ipolate-.

    Comment


    • #3
      Thanks.
      HTML Code:
          bysort ID: ipolate age wave, gen(ageimputed) epolate
      did the job. What this method cannot impute, however, is when an individual only responded to one wave.

      Anyway, this is in my case not problematic, since those observations are dropped anyhow in my DID.

      Comment

      Working...
      X