Hi all,

Hope you can help me with what hopefully should be fairly simple, but I have not been able to find an answer.

I have a dataset of panel data, easiest for me to explain it with this table:
time id var1 var_joint
1 A 3 3
2 A 4 5
1 B 2 3
2 B 5 5
(values are arbitrary...)

I have been able to run the following regression:
reg var_joint var1 if id == A

But now I wish to regress the var1 outcomes for B onto A, ie:
reg var1_B var1_A

How do I split the data set this way? I have tried some generate formulas but with no luck...