Statalist


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

st: RE: Fwd: FW: duration of mulitple episodes in panel data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Fwd: FW: duration of mulitple episodes in panel data
Date   Tue, 24 Jun 2008 18:22:13 +0100

Check out -tsspell- from SSC, or equivalently 

SJ-7-2  dm0029  . . . . . . . . . . . . . . Speaking Stata: Identifying
spells
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
J. Cox
        Q2/07   SJ 7(2):249--265                                 (no
commands)
        shows how to handle spells with complete control over
        spell specification

Nick 
n.j.cox@durham.ac.uk 

Maarten Buis forwarded a message from Mukesh Dherani, edited here: 

> In my dataset there may be multiple episodes of disease for each
child.
> I want to assess the duration of each episode assuming that an episode
> ends on a visit before a disease-free visit.  For example: for child
> 1 the first episode started on 12th Jan and ended on 15th as the next
visit
> on 22nd was disease-free. Hence the duration of that particular
episode
> was 4 days. 
> 
> The first three columns are what I have got in my dataset, I need to
> create the last three columns. 
> 
> I tried various -egen-  functions like -group()- or -count()- but to
no
> avail.  I tried searching FAQ on stata.com but so far no success. Can
> someone help me please?

ID date episode episode number visits episode lasted Duration of
episode
 
1 05/01/2006 0
    
1 12/01/2006 1 1 1
  
1 15/01/2006 1 1 2 4
 
1 22/01/2006 0    

1 30/01/2006 1 2 1
  
1 05/02/2006 1 2 2 7
 
1 10/02/2006 1 2 3 12
 
1 15/02/2006 0
    
2 03/01/2006 0
    
2 10/01/2006 0
    
2 15/01/2006 0
    
2 18/01/2006 1 1 1
  
2 25/01/2006 0
    
2 01/02/2006 0
    
2 08/02/2006 1 2 1
  
2 15/02/2006 1 2 2 8
 
2 25/02/2006 1 2 3 18


*
*   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/



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