Hi!
I am having trouble reshaping my data to long by month-year for each month-year an observation is in my dataset and hoping this forum can help. Currently the data are long, but by round. Each round has a beginning date (BEDGDATE) and an end date (ENDDATE), which can span any number of months/years. Important to note is that the beginning date of a round is the same as the end date of the previous round, and each observation can have anywhere from 1-9 total rounds.
Here is what my date currently look like:
Here is what I would like the final product to look like. To note, once the data have been reshaped to long, variables like RACE, INC, INS, MARITAL should be filled in for all the month-years within each round.
Thank you in advance for the assistance!
I am having trouble reshaping my data to long by month-year for each month-year an observation is in my dataset and hoping this forum can help. Currently the data are long, but by round. Each round has a beginning date (BEDGDATE) and an end date (ENDDATE), which can span any number of months/years. Important to note is that the beginning date of a round is the same as the end date of the previous round, and each observation can have anywhere from 1-9 total rounds.
Here is what my date currently look like:
STUDYID | PANEL | ROUND | BEGDATE (YYMM) | ENDDATE (YYMM) | RACE | MARITAL | INCOME | INS |
12112 | 24 | 1 | 2018m1 | 2018m3 | ASIAN | SING | 120K | PUB |
12112 | 24 | 2 | 2018m3 | 2018m5 | ASIAN | MAR | 150K | PRIV |
12112 | 24 | 3 | 2018m6 | 2018m8 | ASIAN | MAR | 173K | PRIV |
Etc…. |
Here is what I would like the final product to look like. To note, once the data have been reshaped to long, variables like RACE, INC, INS, MARITAL should be filled in for all the month-years within each round.
DUPERSID | PANEL | Round | DATE | RACE | INCOME | INS | MARITAL |
12112 | 24 | 1 | 2018m1 | Asian | 120K | PUB | SINGLE |
12112 | 24 | 1 | 2018m2 | Asian | 120K | PUB | SINGLE |
12112 | 24 | 1 | 2018m3 | Asian | 120K |
PUB | SINGLE |
12112 |
24 | 2 | 2018m4 | Asian | 150K |
PRIV | MARRIED |
12112 | 24 | 2 | 2018m5 | Asian | 150K | PRIV | MARRIED |
12112 |
24 | 3 | 2018m6 | Asian |
173K | PRIV |
MARRIED |
12112 | 24 | 3 | 2018m7 | Asian |
173K |
PRIV |
MARRIED |
12112 | 24 | 3 | 2018m8 | Asian |
173K |
PRIV |
MARRIED |
Thank you in advance for the assistance!
Comment