[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Linn Renée Naper <linn.naper@ecgroup.no> |

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

Subject |
st: calculating the mean of x til X[_n+t] |

Date |
Fri, 28 Nov 2008 00:43:20 +0100 |

I have problems in generating a variable I need in my calculations: I need to generate a variable X2 as a mean of the variable X1 and the next x1[_n+1] til X1[_n+8]. Thus the value of X2 is going to change for each observation in the samlpe Can this be done using egen? As this variable X2 will be changed it is not very practical to calculate the mean by typing X2=(X1 + X1[_n+1] etc..)/n. Thanks L * * 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/

- Prev by Date:
**Re: how to reply on Statalist [was: RE: st: Categorizing HIV status using a series of string variables]** - Next by Date:
**st: RE: RE: re: if-sentences in Stata** - Previous by thread:
**st: METAGRAPH after META command - is it possible to truncate (manually define ticks)** - Next by thread:
**st: keep or delete the commands which need to revise when editing do files?** - Index(es):

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