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

From |
"Carlo Lazzaro" <carlo.lazzaro@tin.it> |

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

Subject |
st: RE : R: Intervals time |

Date |
Tue, 22 Apr 2008 16:22:52 +0200 |

Dear Alvine, is it something like this? ..................................................................... sum time if id==2 & treat==1 Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- time | 3 3.333333 4.041452 1 8 ...................................................................... HTH and Kind Regards, Carlo -----Messaggio originale----- alvine.bissery@chu-lyon.fr wrote: [snip] 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 ! Thanks Alvine -----Message d'origine----- De : owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] De la part de Carlo Lazzaro Envoyé : 22 April 2008 14:38 À : statalist@hsphsun2.harvard.edu Objet : st: R: Intervals time Dear Alvine, Please take a look at what follows: ------------------begin example----------------------- g begin_2 = date( begin,"dm20y") format begin_2%d g end_2 = date( end,"dm20y") format end_2%d g time= end_2- begin_2 g time_0=time if treat==0 g time_1=time if treat==1 -------------------end example------------------------ HTH and Kind Regards, Carlo alvine.bissery@chu-lyon.fr wrote: Dear all, My data deals with subjects who receive 1, 2 or more treatements over time. We want to know how many time they spent with 1 treatment, 2 treatments, 3 treatments , ... Data 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 How can I calculate time spent with 1 treat for id=1, time spent with 2 treat for id=1, ... Maybe with after data has been stset ? Thank you for help ! Alvine Bissery * * 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/ * * 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/ * * 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/ * * 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/

- Prev by Date:
**RE: st: trend in ORs across ordered levels of a 3rd variable** - Next by Date:
**RE: st: trend in ORs across ordered levels of a 3rd variable** - Previous by thread:
**st: re: moremata on the Mac** - Next by thread:
**st: bug in -rndbinx-?** - Index(es):

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