Suppose I have the following:
I want to create a variable that takes on the values of the row and make it into a column without reshaping the whole data. So, something that looks like this:
So while I want this, I don't want to reshape the whole dataset and would prefer to just create new variables to do this (if possible), as we have millions of observations and there is a lot of going back and forth between what I want to do with these variables and what I have to do with the existing format and it would take a very long time to have to continuously switch back and forth. I hope this makes sense- thanks!
Year | ID | Period | 10th Percentile | 20th Percentile | 30th Percentile |
2019 | 1 | 1 | 100 | 200 | 300 |
2020 | 1 | 2 | 400 | 500 | 600 |
I want to create a variable that takes on the values of the row and make it into a column without reshaping the whole data. So, something that looks like this:
Year | Percentile | Variable of Interest |
2019 | 10 | 100 |
2019 | 20 | 200 |
2019 | 30 | 300 |
2020 | 10 | 400 |
2020 | 20 | 500 |
2020 | 30 | 600 |
Comment