[email protected] wrote:
> Tim Wade suggested
>
> > . qui bysort id (x): replace x=x[1]
>
> Thanks Tim. This is indeed better and it hadn't occured to me probably
> because I tend to not remember what order -sort- puts things in and so
> I try not to rely on the specific order (ascending or descending) if I
> can avoid it. (I know I can just look it up or experiment, and I do
> when needed.) Nevertheless, I think I will adopt this approach since
> it is one line long and clearer.
No need for look up here. The -bysort- command explicitely orders the variable
according to id _and_ x. This is why the x is mentioned in the parentheses of
the by-prefix.
Uli
--
[email protected]
+49 (030) 25491-361
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/