Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: median of consecutive groups - avoiding loops
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: median of consecutive groups - avoiding loops
Date
Thu, 12 May 2011 00:06:56 +0200
I guess in most situations there is a way to work around.
Try
g int new_group = cond(mod(group, 2), group, group-1)
bys new_group : egen median = median(value)
However, in general I think there is no way you can use Stata
efficiently without loops.
Best
Daniel
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/