I use panel data that I have set via
Code:
mi xtset id survey
Now I also have multiple imputation, and I don't want those imputation to vary when regressed so I do the following:
Code:
sort id survey _mi_m
Code:
bys id survey _mi_m: gen treatment=0 if (expectation==2 & f.gift_received==2 & gift_total < 50000000) | (l.expectation==2 & gift_received==2 & gift_total < 50000000) bys id survey _mi_m: replace treatment=1 if (expectation==2 & f.gift_received==1 & gift_total < 50000000) | (l.expectation==2 & gift_received==1 & gift_total < 50000000)
This is the variable that I later want to be my dependent variable in the regression. However, I was warned that there could be an issue here with my sorting and the use of my l. and f. operators.
However, I cannot find any issue, and no thread I can find on statalist or elsewhere indicates this. bys and sort are functionally the same so they shouldn't cause any trouble.
The only thing I can think of is that the l. and f. operators use the presuppossed sort from mi xtset, which is id and survey. However I also just want to sort within each id the multiple imputations. Is this a source of issue? If not, what could be? What am I missing?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id byte(_mi_m survey expectation gift_received) 27 0 2 1 2 27 1 2 1 2 27 2 2 1 2 27 3 2 1 2 27 4 2 1 2 27 5 2 1 2 36 0 1 2 1 36 0 2 2 2 36 1 1 2 1 36 1 2 2 2 36 2 1 2 1 36 2 2 2 2 36 3 1 2 1 36 3 2 2 2 36 4 1 2 1 36 4 2 2 2 36 5 1 2 1 36 5 2 2 2 67 0 1 2 1 67 0 2 2 1 67 1 1 2 1 67 1 2 2 1 67 2 1 2 1 67 2 2 2 1 67 3 1 2 1 67 3 2 2 1 67 4 1 2 1 67 4 2 2 1 67 5 1 2 1 67 5 2 2 1 86 0 1 2 1 86 0 2 2 2 86 1 1 2 1 86 1 2 2 2 86 2 1 2 1 86 2 2 2 2 86 3 1 2 1 86 3 2 2 2 86 4 1 2 1 86 4 2 2 2 86 5 1 2 1 86 5 2 2 2 92 0 1 2 2 92 0 2 2 2 92 1 1 2 2 92 1 2 2 2 92 2 1 2 2 92 2 2 2 2 92 3 1 2 2 92 3 2 2 2 92 4 1 2 2 92 4 2 2 2 92 5 1 2 2 92 5 2 2 2 128 0 1 2 2 128 0 2 2 2 128 1 1 2 2 128 1 2 2 2 128 2 1 2 2 128 2 2 2 2 128 3 1 2 2 128 3 2 2 2 128 4 1 2 2 128 4 2 2 2 128 5 1 2 2 128 5 2 2 2 130 0 1 1 1 130 1 1 1 1 130 2 1 1 1 130 3 1 1 1 130 4 1 1 1 130 5 1 1 1 178 0 1 2 1 178 1 1 2 1 178 2 1 2 1 178 3 1 2 1 178 4 1 2 1 178 5 1 2 1 303 0 1 1 2 303 1 1 1 2 303 2 1 1 2 303 3 1 1 2 303 4 1 1 2 303 5 1 1 2 484 0 1 2 1 484 0 2 2 2 484 1 1 2 1 484 1 2 2 2 484 2 1 2 1 484 2 2 2 2 484 3 1 2 1 484 3 2 2 2 484 4 1 2 1 484 4 2 2 2 484 5 1 2 1 484 5 2 2 2 594 0 1 1 1 594 0 2 2 2 594 1 1 1 1 594 1 2 2 2 end
0 Response to operators and how my data is arranged
Post a Comment