Bookmark and Share

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: Creating a new series from a group of multiple series


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Creating a new series from a group of multiple series
Date   Wed, 9 Mar 2011 09:17:07 +0000

egen x1 = rowmedian(y1-y10)

See also for a review

SJ-9-1  pr0046  . . . . . . . . . . . . . . . . . . .  Speaking Stata: Rowwise
        (help rowsort, rowranks if installed) . . . . . . . . . . .  N. J. Cox
        Q1/09   SJ 9(1):137--157
        shows how to exploit functions, egen functions, and Mata
        for working rowwise; rowsort and rowranks are introduced

(An official -egen, rowmedian()- and -egen, rowpctile()- was
introduced after that column was written, in Stata 11.)

Nick

On Wed, Mar 9, 2011 at 8:44 AM, Syed Basher <[email protected]> wrote:

> I have 10 series with 30 observation each. The series are labeled as y1,
> y2,y3,...,y10. I want to generate a new series (say, x1) which is the median
> of 10 series, and x1 should also contain 30 observation. So basically x1 will be
> the median of 10 y but by observation. I tried doing it using foreach loop, due
> to wrong commands I got 10 median observations for each y. Any hint or help is
> highly appreciated. I am using Stata 11.1.

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index