Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: copy value within group

To   Tim Wade <>
Subject   Re: st: copy value within group
Date   Mon, 23 Oct 2006 09:56:48 -0400

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. Thanks.

* For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index