Multiple Means of a List (in Stata)

This forum made possible through the generous support of SDN members, donors, and sponsors. Thank you.

boomerang12

New Member
10+ Year Member
Joined
Sep 15, 2011
Messages
1
Reaction score
0
I have a list of years and coefficients and would like to create new variables, year2 and average coefficients. For each year2 entry, I want to have the average coefficients entries to be the average coefficients for the past 3 years. For example:
Code:
year coef1 coef2 coef3       year2 coef1_avg coef2_avg coef3_avg
01    .5      .7       .3       01      .       .        .
02    .8      .2       .4       02      .       .        . 
03    .3      .8       .3       03      .       .        . 
04    .9      .9       .7       04    .533    .566     .333               
05    .4      .4       .3       05    .666    .633     .466
06    .1      .2       .2       06    .533    .700     .433 
...

How should I implement this?
Thanks for the help.

Members don't see this ad.
 
I have a list of years and coefficients and would like to create new variables, year2 and average coefficients. For each year2 entry, I want to have the average coefficients entries to be the average coefficients for the past 3 years. For example:
Code:
year coef1 coef2 coef3       year2 coef1_avg coef2_avg coef3_avg
01    .5      .7       .3       01      .       .        .
02    .8      .2       .4       02      .       .        . 
03    .3      .8       .3       03      .       .        . 
04    .9      .9       .7       04    .533    .566     .333               
05    .4      .4       .3       05    .666    .633     .466
06    .1      .2       .2       06    .533    .700     .433 
...

How should I implement this?
Thanks for the help.

You might have better luck if you post this to Statalist...
 
Top