I need some help on how to merge rows in STATA, I would like to merge from:
| Individual | Year | City |
| John Doe | 2018 | NYC |
| John Doe | 2019 | NYC |
| John Doe | 2020 | NYC |
| John Doe | 2019 | LA |
| John Doe | 2020 | LA |
| Kate Smith | 2020 | NYC |
| Kate Smith | 2021 | NYC |
to:
| Individual | Year 1 | Year 2 | City |
| John Doe | 2018 | 2020 | NYC |
| John Doe | 2011 | 2020 | LA |
| Kate Smith | 2020 | 2021. | NYC |
How should I do it?
Thank uuu
| Individual | Year | City |
| John Doe | 2018 | NYC |
| John Doe | 2019 | NYC |
| John Doe | 2020 | NYC |
| John Doe | 2019 | LA |
| John Doe | 2020 | LA |
| Kate Smith | 2020 | NYC |
| Kate Smith | 2021 | NYC |
to:
| Individual | Year 1 | Year 2 | City |
| John Doe | 2018 | 2020 | NYC |
| John Doe | 2011 | 2020 | LA |
| Kate Smith | 2020 | 2021. | NYC |
How should I do it?
Thank uuu

Comment