| id | c1 | c2 | c3 | 
| 1 | 100 | 200 | 300 | 
| 2 | 200 | 100 | 150 | 
Code:
rename c1 asset90
| id | asset90 | asset91 | asset92 | 
| 1 | 100 | 200 | 300 | 
| 2 | 200 | 100 | 150 | 
Code:
reshape long asset i(id) j(year)
| id | year | asset | 
| 1 | 1990 | 100 | 
| 1 | 1991 | 200 | 
| 1 | 1992 | 300 | 
| 2 | 1990 | 200 | 
| 2 | 1991 | 100 | 
| 2 | 1992 | 150 | 
Could you help me with this?
And then I want to transform it from wide to long type (please let me know if there's a better way).
Thank you.
0 Response to rename variables using loops
Post a Comment