Statalist


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

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


From   Howard Lempel <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: assign a mean/median a value to a new variable
Date   Wed, 5 Nov 2008 15:55:43 -0500

Try:

egen x = mean(Y)

In general, -help egen- will show you a ton of uses for the -egen command.

Hope this helps.
-Howie

Howie Lempel
Research Assistant
The Brookings Institution | Economic Studies

1775 Massachusetts Ave NW | Washington DC 20036
[email protected] | p: (202) 238-3576

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Shuaizhang Feng
Sent: Wednesday, November 05, 2008 2:11 PM
To: [email protected]
Subject: st: assign a mean/median a value to a new variable

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/

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