Hi All,
I am struggling to combine my long panel data to pairs and wonder if anyone can give me a hint.
Suppose I have a long panel dataset
Time Country Variable
t1 a a1
t2 a a2
t3 a a3
t1 b b1
t2 b b2
t3 b b3
t1 c c1
t2 c c2
t3 c c3
I would like to convert this dataset to following format
Time Country Pair Variable
t1 ab a1-b1
t2 ab a2-b2
t3 ab a3-b3
t1 ac a1-c1
t2 ac a2-c2
t3 ac a3-c3
.....
.....
t1 cb c1-b1
t2 cb c2-b2
t3 cb c3-b3
I thought about first converting the long format to wide format but I have 100+ variables, and 50+ countries, so the wide format will have a lot of variables.
Any hint or suggestions are extremely appreciated!!
Thanks!
Related Posts with How to expand the panel data to pairs
identify repeated observation within variable by idHi, I need to identify by id who has the same grade repeated multiple times. I have used [_n] and […
Matching and clogit functionI am trying to run a binary logistic regression to predict REIT takeover targets. I collected data o…
Advice on calculating weighted variable by lagged variableDear Statalists, Even though I went through many related discussions and read many papers about thi…
Creating quartiles using loop for 25 continuous independent variablesAny suggestion how to fix this loop ? I am trying to create quartiles for 25 continuous independent …
Declaring data to be time-series dataHi everyone! I have monthly data set presented as such Code: * Example generated by -dataex-. To…
Subscribe to:
Post Comments (Atom)
0 Response to How to expand the panel data to pairs
Post a Comment