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

From |
Man Jia <jia.m@neu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: let loop stop when the first variable x becomes 0 |

Date |
Thu, 19 Jun 2008 20:05:07 -0400 (EDT) |

Dear Statalists, I have a data set like this: ------------------------------------------------------------------- ID,x1995, x1996, x1997, x1998, x1999, x2000, x2001, x2002 1 1 0 1 1 0 1 0 0 2 0 0 0 0 1 0 0 0 3 1 1 0 1 0 0 0 0 --------------------------------------------------------------------- I want to find out for each observation the first year when the value of the variable x becomes 0. For example, for observation 1, the first year x becomes 0 is 1996. For observation 2 and 3, 1995 and 1997 respectively. I'm not sure how to let the "searching the first 0" loop stop when x becomes 0. I checked STATA's help; I was wondering if the command "continue" will work here. Could someone give me some hints about this? Thanks a lot! Mandy Jia * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: let loop stop when the first variable x becomes 0***From:*Keith Dear <keith.dear@anu.edu.au>

- Prev by Date:
**Re: st: Manipulating a data structure** - Next by Date:
**Re: st: let loop stop when the first variable x becomes 0** - Previous by thread:
**st: xttobit not converging log likelihood "not concave"** - Next by thread:
**Re: st: let loop stop when the first variable x becomes 0** - Index(es):

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