Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: calculating means over time


From   "Maureen Paul" <[email protected]>
To   <[email protected]>
Subject   st: calculating means over time
Date   Mon, 21 Oct 2002 17:22:34 +0100

Hi 
I am trying to efficiently generate the mean of a few variables for
each individual over time. I have done the following but it does not
seem to do what I intend. Can anyone help me out here? Thanks. So just
to make the problem clearer, I have a panel of individuals and would
like to calculate for each individual over time, the mean of, say, age
wage and number of children.

mac def y "age wage children"
for var $y: by(pid): egen sumX=sum(X)
for var $y: egen zX=mean(sumX)

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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