Announcement

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

  • Reshaping data when one wave is missing

    I want to reshape my data from wide to long.
    In the data (SHARE), I have variables myvar1 myvar2 myvar4 myvar5, whereby myvar3 is missing because wave 3 contained different questions (life history questions).

    I use the following
    HTML Code:
    reshape long `varlist', i(`ID') j(wave) 
    This produces an error in reshaping.

    There are two options that could solve this: a) for each selected variable in varlist, generate a missing myvar3, or b) an adaptation to the reshape command as this problem might be more common in other panel studies.
    Does anyone have an idea about (b)?

  • #2
    I don't think the missing myvar3 is the reason for your error.

    Consider

    Code:
    clear
    input byte(ID myvar1 myvar2 myvar4 myvar5)
    50   1   2   4   5
    51   2   4   8   10
    52   3   6   12  15
    end
    
    reshape long myvar, i(ID) j(wave)
    You can verify that the reshape works just fine.
    Last edited by Hemanshu Kumar; 08 Jul 2023, 09:27.

    Comment


    • #3
      #2 was correct. My post can be deleted. Apologies.

      Comment

      Working...
      X