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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

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

Subject |
st: Re: How to detect the change of i over t? |

Date |
Sun, 8 Feb 2009 10:52:24 +0100 |

<> See NJC`s FAQ: http://www.stata.com/support/faqs/data/panel.html ********* clear* set obs 20 egen float id = seq(), from(1) to(4) block(5) egen float t = seq(), from(1) to(5) block(1) g x=cond(runiform()<=0.5,0,1) g byte become=. bys id: replace become=cond(x[_n-1]==0 & x[_n]==1,1,0) list, noo sepby(id) *********** HTH Martin _______________________

To: "stata" <statalist@hsphsun2.harvard.edu> Sent: Sunday, February 08, 2009 5:46 AM Subject: st: How to detect the change of i over t?

Hi all:I am using an unbalanced panel dataset. i is ID and t is time. Every (i,t)has a characteristic x=0 or 1.I want to generate a variable called "become" such that for each (i,t): become=1, if x=0 at time t-1, and x=1 at time t become=0, otherwiseHow to write it? My primary concern is how to deal with the first t foreach i--this observation does not have t-1.Any suggestion would be greatly appreciated. Ben _________________________________________________________________ Windows Live™: E-mail. Chat. Share. Get more ways to connect. http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_allup_howitworks_022009 * * 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/

**Follow-Ups**:**RE: st: Re: How to detect the change of i over t?***From:*Benson Limann <benli2@live.com>

**st: RE: Re: How to detect the change of i over t?***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: How to detect the change of i over t?***From:*Benson Limann <benli2@live.com>

- Prev by Date:
**st: reading data with missing obs** - Next by Date:
**st: FWD: poisson regression on aggrgregated data** - Previous by thread:
**st: How to detect the change of i over t?** - Next by thread:
**st: RE: Re: How to detect the change of i over t?** - Index(es):

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