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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

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

Subject |
st: RE: RE: RE : R: Intervals time |

Date |
Tue, 22 Apr 2008 16:18:26 +0100 |

Correction: gen duration = end - begin + 1 drop if treat == 0 gen long obs = _n expand dur bysort id obs : replace begin = begin[_n-1] + 1 if _n > 1 l contract id begin I get 3 treatments on 16 May. -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 22 April 2008 16:06 To: statalist@hsphsun2.harvard.edu Subject: st: RE: RE : R: Intervals time Is this what you want? gen duration = end - begin + 1 drop if treat == 0 expand dur bysort id begin : replace begin = begin[_n-1] + 1 if _n > 1 l contract id begin Nick n.j.cox@durham.ac.uk alvine.bissery@chu-lyon.fr Thank you Carlo, but this will not answer my question. Maybe it was not clear ! Sata are as follows: id begin end treat 1 04 Apr 2006 06 Apr 2006 1 1 05 Apr 2006 09 Apr 2006 0 1 08 Apr 2006 12 Apr 2006 1 2 15 May 2006 16 May 2006 1 2 16 May 2006 24 May 2006 1 2 16 May 2006 17 May 2006 1 Subject 2 has only one treatment from 15 May 2006 to 16 May 2006. Then he has two treatments from 16 May 2006 to 17 May 2006, and one treatment from 18 May 2006 to 24 May 2006. This is the result I want to find ! * * 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/

**References**:**st: R: Intervals time***From:*"Carlo Lazzaro" <carlo.lazzaro@tin.it>

**st: RE : R: Intervals time***From:*alvine.bissery@chu-lyon.fr

**st: RE: RE : R: Intervals time***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: RE : R: Intervals time** - Next by Date:
**st: RE: bug in -rndbinx-?** - Previous by thread:
**st: RE: RE : R: Intervals time** - Next by thread:
**st: A loop for S.D calculation in paneldata set** - Index(es):

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