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]
st: RE: Creating a new series from a group of multiple series
From
Jan Bryla <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: RE: Creating a new series from a group of multiple series
Date
Wed, 9 Mar 2011 10:14:07 +0100
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().
Hope this helps...
Jan Bryla
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Syed Basher
Sent: 9. marts 2011 09:44
To: Statalist
Subject: st: Creating a new series from a group of multiple series
Dear Statalist,
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.
Syed Basher
Doha, Qatar
*
* 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/