Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: RE: Recording episodes


From   "Michael Ghebre" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Recording episodes
Date   Thu, 7 Jul 2011 15:14:55 +0100

Thank you a lot, Nick; that is excellent stuff which helped me to sort-out
my problem!

Best
Michael A Ghebre
Research Fellow in Medical Statistics
Centre for Environmental and Preventive Medicine 
Wolfson Institute of Preventive Medicine 
Barts and the London School of Medicine and Dentistry 
Queen Mary University of London 
Charterhouse Square London EC1M 6BQ
Email : [email protected] 
Tel : 02078826267
http://www.wolfson.qmul.ac.uk



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 06 July 2011 18:44
To: '[email protected]'
Subject: st: RE: Recording episodes

See -tsspell- from SSC and 

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 
[email protected] 

Michael Ghebre

I have 1000 subjects (two treatment groups) and about 200 visits for
individual subject and recorded their diarrhea [0= no diarrhea and 1=
diarrhea]. 

I want to record episodes of diarrhea as 1 (episodes=1) if there is series
of diarrhea; and if there is 2 or more diarrhea-free days (diarrhea = 0)
after a diarrhea days and the next days with diarrhea (diarrhea=1), recorded
as second episode of diarrhea (episode=1). Example in the table below, 

I want to write stata code which could help me recording the episodes based
on the sequence of diarrhea.

+-------------------------------------+
     | subjId   visit   diarrhea   episode |
     |-------------------------------------|
  1. |      1       1          0         0 |
  2. |      1       2          1         1 |
  3. |      1       3          1         0 |
  4. |      1       4          0         0 |
  5. |      1       5          0         0 |
  6. |      1       6          1         1 |
  7. |      1       7          1         0 |
  8. |      1       8          0         0 |
  9. |      1       9          1         0 |
 10. |      1      10          1         0 |
 11. |      .       .          .         . |
 12. |      .       .          .         . |
 13. |      .       .          .         . |
     |-------------------------------------| 
 14. |      2       1          1         1 |
 15. |      2       2          1         0 |
 16. |      2       3          1         0 |
 17. |      2       4          0         0 |
 18. |      2       5          1         0 |
 19. |      2       6          0         0 |
 20. |      2       7          0         0 |
 21. |      2       8          0         0 |
 22. |      2       9          1         1 |
 23. |      2      10          0         0 |
 24. |      2      11          0         0 |
 25. |      2      12          1         1 |
 26. |      2      13          1         0 |
 27. |      2      14          1         0 |
 28. |      2      15          1         0 |
 29. |      2      16          0         0 |
 30. |      .       .          .         . |
 31. |      .       .          .         . |
 32. |      .       .          .         . |
 

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index