Hi,
I am using individual-level dataset across 4 years to try and calculate the mobility out of low wage between 2020 and 2017. I created these dummy variables (delta2020 and delta2017) expressing 1 if low wage and 0 if not.
However, I need to subtract delta2020 with delta2017 for the same individual (Person_Ref1).
How can I create a variable like diff below?
input Person_Ref1Person_Ref2 delta2020 delta2017 diff
"1000501" "2017" . 1 .
"1000501" "2018" . . .
"1000501" "2019" . . .
"1000501" "2020" 1 . 0
"1000502" "2017" . 0 .
"1000502" "2018" . . .
"1000502" "2019" . . .
"1000502" "2020" 0 . 0
"1000503" "2017" . 0 .
"1000503" "2018" . . .
"1000503" "2019" . . .
"1000503" "2020" 1 . 1
"1000701" "2017" . 1 .
"1000701" "2018" . . .
"1000701" "2019" . . .
"1000701" "2020" 1 . 0
"1000702" "2017" . 1 .
"1000702" "2018" . . .
"1000702" "2019" . . .
"1000702" "2020" 1 . 0
"1000703" "2017" . 0 .
"1000703" "2018" . . .
"1000703" "2019" . . .
"1000703" "2020" 0 . 0
"1002601" "2017" . 0 .
"1002601" "2018" . . .
"1002601" "2019" . . .
"1002601" "2020" 0 . 0
"1004203" "2017" . 1 .
"1004203" "2018" . . .
"1004203" "2019" . . .
"1004203" "2020" 1 . 1
Appreciate your help and thanks in advance
Related Posts with Creating new variable (subtracting) same individual
Test difference between predicted valuesHello, I have a model which is regressing log wages on being immigrant/native. However, immigrant a…
Interpreting AME after margins commandDear all, I am using the -margins- command to estimate the impact of several binary explanatory var…
Calculating the proportion of observations that fulfill successive conditionsDear Statalisters, I have data following movements of cyclists through designated checkpoints. Each…
Fitting Random Slope in Mixed ModelsGreetings Experts, I use stata version 15.0. I have longitudinal data that I am trying to fit some …
Map integration: Distance from tube station?Is there a Stata package that can calculate the distance of an address from a category of landmarks?…
Subscribe to:
Post Comments (Atom)
0 Response to Creating new variable (subtracting) same individual
Post a Comment