[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: RE: RE: re: if-sentences in Stata |

Date |
Fri, 28 Nov 2008 00:40:24 +0100 |

Thanks Kit, I think your command is going to work. At least its working when trying it out on a Small test-sample. My actual sample has more than 60 000 obs. I have problems in generating a variable I need In the calculations however: I need to generate a variable X2 as a mean of the variable X1 and the next x1[_n+1] til X1[_n+8]. 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 L -----Opprinnelig melding----- Fra: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] På vegne av Linn Renée Naper Sendt: 27. november 2008 20:41 Til: statalist@hsphsun2.harvard.edu Emne: st: RE: re: if-sentences in Stata Thanks I am looking into your proposed solution right now. Linn -----Opprinnelig melding----- Fra: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] På vegne av Kit Baum Sendt: 27. november 2008 20:34 Til: statalist@hsphsun2.harvard.edu Emne: st: re: if-sentences in Stata < > Linn said I've tried and it really doesn't matter... I get the same result. And that result will presumably be meaningless, as a statement like if shift == 1 will ever only reference the FIRST observation of the variable shift. Given what you have outlined as the logic, I cannot imagine that this could be useful. Please see my proposed solution. Kit Baum, Boston College Economics and DIW Berlin http://ideas.repec.org/e/pba1.html An Introduction to Modern Econometrics Using Stata: http://www.stata-press.com/books/imeus.html * * 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/ * * 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: re: if-sentences in Stata***From:*Kit Baum <baum@bc.edu>

**st: RE: re: if-sentences in Stata***From:*Linn Renée Naper <linn.naper@ecgroup.no>

- Prev by Date:
**st: calculating the mean of x til X[_n+t]** - Next by Date:
**st: keep or delete the commands which need to revise when editing do files?** - Previous by thread:
**st: RE: re: if-sentences in Stata** - Next by thread:
**st: RE: re: if-sentences in Stata** - Index(es):

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