Hello,
It is easier to describe my question using a example as shown in attachment. In the data, the observations are ranked by Value from low to high (column 2), and each has a dummy==0 or 1 (column 3), the purpose is to generate a column (column 4), which shows the number of observations (with dummy==0), which have lager values than the observed one (with dummy==1)? For example, for Observation D, it is 2 in New Column, because among the observations, which have larger Value than 4 (value of Observation D), there are 2 obervations with dummy of 0.
Array
Could anyone enlighten me how to write the command to generate such a cloumn? I tried to combine by with egen and count, however, the result is not what I want.
Really urgent here... T_T Thousand thanks!!!!
Looking forward to your kind reply.
Cici
It is easier to describe my question using a example as shown in attachment. In the data, the observations are ranked by Value from low to high (column 2), and each has a dummy==0 or 1 (column 3), the purpose is to generate a column (column 4), which shows the number of observations (with dummy==0), which have lager values than the observed one (with dummy==1)? For example, for Observation D, it is 2 in New Column, because among the observations, which have larger Value than 4 (value of Observation D), there are 2 obervations with dummy of 0.
Array
Could anyone enlighten me how to write the command to generate such a cloumn? I tried to combine by with egen and count, however, the result is not what I want.
Really urgent here... T_T Thousand thanks!!!!
Looking forward to your kind reply.
Cici