I have a dataset that looks like this.
And the list goes on. There are SO MANY variables. I want to convert this to a format in which the 'year' at the end of the variables becomes a new column and thus looks like a time series dataset.
One way could be listing all the variables and then simply writing-
But, as I said, the varlist is long, and there is no definitive format that its naming follows. I wonder if there is any more economical and efficient way of doing this.
Any input is appreciated.
Code:
id a_1990 b_c_1990 d_e_1990 a_2019 b_c_2019 d_e_2019 100 4639 3034.902 1604.098 5641 3152.705 2488.295 200 3591 2532.941 1058.059 1549 961.7407 587.2593 301 3427 2575.986 851.0145 1620 1039.885 580.1152 302 5790 3420.109 2369.891 6344 3061.887 3282.113
One way could be listing all the variables and then simply writing-
Code:
reshape long varlist, i(id) j(year)
Any input is appreciated.


Comment