Announcement

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

  • Help with calculating differences between the same observation

    Hello, I am currently working on the effect of covid 19 on unemployment and I have four waves (2018,2019,2020,2021) of household survey for the same households. Currently, I am having a little bit of challenge calculating the change in different outcome variable across two different rounds. For example if I take individual 1001, I want to look at the change in the income of this individual in 2018 and 2019.

  • #2
    maybe the following example is useful,
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int(id year) byte income
    1001 2018 20
    1001 2019 21
    1001 2020 22
    1001 2021 23
    1002 2018 27
    1002 2019 26
    1002 2020 25
    1002 2021 24
    end
    
    by id (year), sort: gen wanted = income - income[_n-1]

    Comment

    Working...
    X