I have tried
egen pri_sum=rowtotal(pri_q1-pri_q7) if (pri_*) < 2
and
egen pri_sum=rowtotal(pri_q1-pri_q7) if pri_* < 2
I think that "if" just does not work for conditioning on row total. Is there another option?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(id pri_q1 pri_q2 pri_q3 pri_q4 pri_q5 pri_q6 pri_q7) 1 1 1 1 1 2 2 1 2 1 1 1 1 1 2 1 3 2 2 2 2 1 2 2 4 1 1 1 1 1 3 1 5 1 2 2 1 2 2 2 6 1 1 1 2 2 1 2 7 1 1 1 1 2 1 2 8 1 1 1 1 3 2 2 9 1 2 1 3 3 1 1 10 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 12 1 1 1 1 1 1 2 13 1 1 1 1 1 1 1 14 1 2 2 2 1 2 2 15 1 1 1 1 1 1 1 16 1 2 2 1 3 1 1 17 1 2 2 2 1 1 2 18 1 2 2 2 1 1 1 19 1 2 2 2 1 2 2 20 1 1 1 1 1 2 2 21 1 1 1 3 1 2 1 22 1 2 2 1 1 1 2 23 1 1 1 1 2 2 2 24 1 1 1 1 1 1 2 25 1 1 1 1 2 2 2 26 1 1 2 1 2 2 2 27 1 1 1 3 3 1 3 28 1 2 2 1 1 2 1 29 1 1 1 3 1 1 2 30 2 2 2 2 2 2 2 31 1 1 1 1 1 2 1 32 1 1 1 1 1 1 1 33 1 2 1 1 2 2 2 34 1 2 2 1 2 2 2 35 1 1 1 2 1 2 2 36 1 1 2 2 1 2 2 37 1 3 1 2 2 2 2 38 1 1 1 1 1 1 2 39 1 1 1 1 3 1 2 40 1 1 1 1 2 1 2 end
0 Response to conditional rowtotal
Post a Comment