Dear All, The question is related to a previous post here. Now, the expanded data is
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str10 P float(t x w z)
"A" 0          2  2 3 
"B" 1  10.333333  8 4
"C" 0          1  1 5
"C" 1         -5  6 9
end
The desired outcome is
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str10 P float(t x w z) 
"A" 0         2 2 3 
"A" 1         0 2 3 
"B" 0         0 8 4 
"B" 1 10.333333 8 4 
"C" 0         1 1 5 
"C" 1        -5 6 9 
end
There are two observations when P="C" (with t=0 and 1). This is what I need, and don't need to do anything.

However, when P="A", only one observation is available (t=0), I need another observation to be exactly the same (including the values of MANY other variables (e.g., w z), their values must be the same) as the (t=0) observation but with t=1, and x=0.

Similarly, when P="B", only one observation is available (t=1), I need another observation to be exactly the same (including the values of MANY other variables (e.g., w z), their values must be the same) as the (t=1) observation but with t=0, and x=0.

Any suggestions? Thanks.