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
Help ReshapingHi, I am trying to reshape the data so I have just four columns, name code year and Alevels. My data…
Separate observations depending on their value in one variableHi all, I have a dataset with many variables that indicate people and certain characteristics, but …
Create a rank variable mpg rank 12 1 12 1 14 2 14 2 14 2 15 3 15 3 16 4 17 5 I want to create a ran…
Query about command "arima"Hello I am using the arima command to estimate an ARMA process. My query is about the the constant …
Parallel foreach?To improve speed I would like to parallelize a loop of this kind: Code: global myvars v1 v2 v3 fo…
Subscribe to:
Post Comments (Atom)
0 Response to How to expand the panel data to pairs
Post a Comment