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: RE: Creating a new series from a group of multiple series
From
Syed Basher <[email protected]>
To
[email protected]
Subject
Re: st: RE: Creating a new series from a group of multiple series
Date
Wed, 9 Mar 2011 01:41:10 -0800 (PST)
Dear Jan and Nick that was very helpful, thank you. Looking forward to reading
Nick's `rowwise' article.
Syed
----- Original Message ----
From: Nick Cox <[email protected]>
To: [email protected]
Sent: Wed, March 9, 2011 12:21:03 PM
Subject: Re: st: RE: Creating a new series from a group of multiple series
In Stata 9 and 10 you can use the user-written -rowmedian()- function
for -egen- included in -egenmore- for SSC, which you must download.
Older and much slower -egen- functions for the same purpose also
exist. Stata 9 made it possible to use Mata for the job.
Nick
On Wed, Mar 9, 2011 at 9:14 AM, Jan Bryla <[email protected]> wrote:
> In Stata 11 I think you can use the rowmedian function in -egen-. In yout case
>egen x1=rowmedian(y1 y2 y3 ... y10)
>
> See help http://www.stata.com/help.cgi?egen
>
> rowmedian(varlist)
> may not be combined with by. It gives the (row) median of the
> variables in varlist, ignoring missing values. If all variables
> in varlist are missing for an observation, newvar is set to
> missing in that observation. Also see rowpctile().
>
On Behalf Of Syed Basher
>
> 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/
*
* 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/