I have a large dataset of health records that I am trying to get from long to wide format. Currently it is in this format.
eid | code | date |
---|---|---|
Person_1 | 123 | 2006-07-12 |
Person_1 | 1555 | 2006-07-12 |
Person_1 | 1989 | 2009-08-12 |
Person_2 | 1020 | 2008-09-12 |
Person_2 | 1220 | 2008-07-15 |
Person_2 | 12929 | 2020-07-22 |
I would like it in this format:
|eid | Code_1 | date_1 | code_2 | date_2 | code_3 | date_3|
and so on. I was struggling with this in reshaping.
Many thanks