I have panel data, with multiple entries per ID for every day they partook in exercise.
Variables:
ID= individual ID
work_date= each date that the individual partook in recorded exercise
import_date= date the individual joined the study (this is repeated for every row of panel data per ID)
exit_date= date the individual exited the study (this is repeated for every row of panel data per ID)
(example in the table below).
the variable work_date does not currently contain the import date or exit date for any ID.
I wish to add/merge the import_date and exit_date to the work_date variable, for each individual.
This is so I can then create a binary variable for import (1/0) and exit (1/0) based on one date variable (work_date) within the data set.
ID | import_date | exit_date | work_date |
1 | 21/01/2019 | 30/04/2020 | 23/01/2019 |
1 | 21/01/2019 | 30/04/2020 | 26/01/2019 |
1 | 21/01/2019 | 30/04/2020 | 02/02/2019 |
1 | 21/01/2019 | 30/04/2020 | 26/02/2019 |
1 | 21/01/2019 | 30/04/2020 | 27/02/2019 |
2 | 03/05/2019 | 10/12/2019 | 15/05/2019 |
2 | 03/05/2019 | 10/12/2019 | 30/05/2019 |
2 | 03/05/2019 | 10/12/2019 | 06/06/2019 |
2 | 03/05/2019 | 10/12/2019 | 20/06/2019 |
Anna
0 Response to Combining date variables in panel data
Post a Comment