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

st: calculating means over time

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

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:

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