Statalist The Stata Listserver


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

Re: st: copy value within group


From   [email protected]
To   Tim Wade <[email protected]>
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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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