Statalist


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

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


From   Shuaizhang Feng <fengsz@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: assign a mean/median a value to a new variable
Date   Wed, 5 Nov 2008 11:11:02 -0800 (PST)

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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index