Dear All, Suppose that I have the following data
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float id str1 rate double y float y_sum
1 "A" 8.3629 9.9999
1 "B" 1.137 9.9999
1 "C" .5 9.9999
2 "A" 25.130000000000003 30.6154
2 "B" 2.87 30.6154
2 "C" 2.6154 30.6154
3 "A" 24.6 30.3355
3 "B" 3.1 30.3355
3 "C" 2.6355 30.3355
end
For each `id', I'd like to calculate a statistic `sublevel'. For id=1, the first value of `sublevel' is equal to the value of rate=B (1.137)+the value of rate=C (.5), and the second value of `sublevel' is equal to the value of rate=C (.5), and the third value of `sublevel' = 0 (always). Any suggestions? Thanks.
0 Response to data calculation.
Post a Comment