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: data management question


From   Maria Cecilia Vieira da Silva <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: data management question
Date   Wed, 29 Feb 2012 23:14:35 +0000

Hello,
My data set looks like below. Each patient (here patient 1 and 2) takes or not pills each day (from day 1 to day 12). I would like to estimate the median number of days that the patients take the pill uninterruptedly. For example, the median is 3 in the case below - Patient 1 (3, 4, 1) and Patient 2 (3, 2).
Any suggestions about how to implement it in a large data set?
I though about creating a dummy (number of pills>0) and performing sums for the series bordered by zeros, but I am not sure about a command that would allow me to create subseries defined as series of numbers bordered by zeros. Actually, if I could create such subseries, it would suffice to perform a count.
Thanks,
Maria Cecilia


id day number of pills
1 1 1
1 2 2
1 3 1
1 4 0
1 5 0
1 6 2
1 7 1
1 8 2
1 9 3
1 10 0
1 11 0
1 12 1
2 1 0
2 2 0
2 3 0
2 4 1
2 5 1
2 6 1
2 7 0
2 8 0
2 9 0
2 10 2
2 11 2
2 12 0
*
*   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