Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: assign a mean/median a value to a new variable


From   "Brian Karfunkel" <[email protected]>
To   [email protected]
Subject   Re: st: assign a mean/median a value to a new variable
Date   Wed, 5 Nov 2008 12:56:21 -0800

-egen-

example:

egen x = mean(y)

-BK

On Wed, Nov 5, 2008 at 11:11 AM, Shuaizhang Feng <[email protected]> wrote:
> Dear all:
>
> Suppose I have a data set that only contains one variable Y. and I want to add a variable x that equals the mean (or median) of Y for all observations. How do I do that?  Apparantly x=mean(Y) doesn't seem to work.
>
> Thank you for your help.
>
> SZ
>
>
>
>
> *
> *   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/
>



-- 
Brian Karfunkel
Research Fellow

Stanford Law School
Crown Quadrangle
559 Nathan Abbott Way
Stanford, California 94305

+1.650.721.5694 (office) | +1.978.886.1607 (mobile)
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index