[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Carlo Lazzaro" <carlo.lazzaro@tin.it> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: R: annual and 3years average |

Date |
Wed, 17 Sep 2008 13:24:17 +0200 |

Dear Fabian, this a possible (but not efficient) solution to your problem (please, see below) --------------------------------begin example--------------------- sum ROE if year==79 replace Average=r(mean) in 1 sum ROE if year==80 replace Average=r(mean) in 4 sum ROE if year==81 replace Average=r(mean) in 5 sum ROE if year==82 replace Average=r(mean) in 7 sum Average if year!=82 g threeyearaverage=r(mean) in 5 sum Average if year!=79 replace threeyearaverage=r(mean) in 7 --------------------------------end example------------------------- HTH and Kind Regards, Carlo -----Messaggio originale----- Da: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Fabian Brenner Inviato: mercoledì 17 settembre 2008 12.50 A: statalist@hsphsun2.harvard.edu Oggetto: st: annual and 3years average Dear all, I have several observations called "ROE" for the "years" (from 1979 to 2006). There is a different number of observations for each year. My data look like this: "year" "ROE" "Average" "threeyearaverage" 79 12 ? ? 79 9 ? ? 79 2 ? ? 80 3 ? ? 81 20 ? ? 81 5 ? ? 82 3 ? ? 82 6 ? ? 82 9 ? ? 82 8 ? ? . . . . . . . . . I want to compute the average of the observations for each year, e.g. for 1979: (12+9+2)/3 (I tried to sort the observations and to divide the sum by _n but it didn't work...) In a second step I want to get the average ROE for the past three years ("threeyearaverage") (beginning in 1982), e.g. for 1982 it should be the average of the ROE in 1979 plus the average ROE in 1980 plus average ROE in 1981, divided by 3. I hope someone has an idea or a solution for this problem...Thanks a lot. Fabian -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger * * 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/

**References**:**st: annual and 3years average***From:*"Fabian Brenner" <Fabian.Brenner@gmx.de>

- Prev by Date:
**Re: st: annual and 3years average** - Next by Date:
**Re: st: detectable alternative/effect size;** - Previous by thread:
**RE: RE: st: annual and 3years average** - Next by thread:
**st: Fwd: STATA/ detectable difference** - Index(es):

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