I need to reorganize my dataset. I have an unbalanced panel dataset in long form for 100 individuals over 70 years (monthly data). I would need to separate every time-series by id. Now I have the following (see a piece of the dataset here Array ):
I have | I need |
date id var1 var2 var3 1950m1 1 value value value 1950m2 1 value value value . . 1951m1 2 value value value 1951m2 2 value value value . . 1993m1 5 value value value 1993m2 5 value value value |
date var1_id1 var2_id1 var3_id1 var1_id2 var2_id2 .... 1950m1 value value value value value 1950m2 value value value . . . . 1951m1 value value value value value |
I tried using
Code:
separate varname, by (id)
Code:
bysort date: gen varname_sum=sum(varname)
I need it because I am still struggling to find a way to regress a panel GARCH with Stata (see this post). After going through a RATS code for it (without having that software), I suspect that, authors are programming a multivariate GARCH model, entering every panel-id variable as dependent or independent in the mean and conditional variance equations. They specify the characteristics of the conditional covariance equation too. Therefore, I will try what George Ford suggested me in the cited post(mgarch).
Thank you for your help.
0 Response to Reorganize data from long (panel) form to id-separated variables?
Post a Comment