Hi, I have balanced panel data with ID and Time (and some other variables), and I want the unique ID-pairs, while preserving the time order. The suggestions I've found seem to offer much more complicated combinations. The simplest example I can think of (while still being clear) has 3 individuals and 3 time periods. In general, if the original data set is n*T obs, the transformed data set should be (n*n-1)/2*T) obs. I can do this with loops, but I'm guessing there is a clever way to do it w/out loops. Thanks for your help.
ID1 t1
ID1 t2
ID1 t3
ID2 t1
ID2 t2
ID2 t3
ID3 t1
ID3 t2
ID3 t3
I would like the resulting data to look like:
ID1-ID2 t1
ID1-ID2 t2
ID1-ID2 t3
ID1-ID3 t1
ID1-ID3 t2
ID1-ID3 t3
ID2-ID3 t1
ID2-ID3 t2
ID2-ID3 t3
If it helps, my transformed data could be as simple as the difference in the values of a variable for the different IDs for each time period.
Related Posts with unique pairs from panel data
propensity score matching modelThis time I will try to make my request a bit clear. I have watched many tutorial videos about PSM m…
regress rob, regression model with robust std. errorsDear community! I have a model with the violation the assumption about homoscedasticity. So first i…
combining variables' dataHello every one today i faced a small issue which is I have three questions Q1 Q2Q3 each one branche…
Create a variable based its proportionDear Stata Users, Please, help me with the following issue. I need to calculate reserves based on t…
name of variable above ttest tableDear all Am running a ttest for several variable by(group) using a loop as below Code: foreach …
Subscribe to:
Post Comments (Atom)
0 Response to unique pairs from panel data
Post a Comment