[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: calculating means over time
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: