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: brace counting for person-time


From   Nabarun Dasgupta <[email protected]>
To   <[email protected]>
Subject   st: brace counting for person-time
Date   Sat, 02 Mar 2013 17:26:02 -0500

Dear STATALIST:

I would greatly appreciate your help and haven't seen exactly what I need
in the archive. I am trying to count the person-days exposed for a single
patient in a given month over multiple overlapping Rx records. The correct
number of days exposed is 26 in the example data below. I tried a "brace
counting" approach, so the variable _ender_ is zero at the start of the Rx
period, and one for the last day of the period. Hence there are eight
records for four prescriptions. One solution would be to calculate the
days in between each _bracedate_ and only add up the unique days between
braces, but I can't figure out how to create a counter that identifies
only the exposed periods. Note that rxno 5061 was only for one day, making
things trickier.

 
 
start	stop	rxno	ender	bracedate
5-Jan-11	12-Jan-11	2248	0	5-Jan-11
12-Jan-11	26-Jan-11	3645	0	12-Jan-11
5-Jan-11	12-Jan-11	2248	1	12-Jan-11
19-Jan-11	30-Jan-11	2261	0	19-Jan-11
25-Jan-11	25-Jan-11	5061	0	25-Jan-11
25-Jan-11	25-Jan-11	5061	1	25-Jan-11
12-Jan-11	26-Jan-11	3645	1	26-Jan-11
19-Jan-11	30-Jan-11	2261	1	30-Jan-11


Generalized schematic of the brace counting approach is below, but I am
open to other solutions. Creating a dummy variable for each date and using
0,1 is not an option as far as I can tell because of the number of
prescription records (55 million) and length of time (3 years).



Overlapping intervals:

 (-------------------)
                      (----------------------)
                                                    (---)
      (---------------------)
                                               (-----------------)

 Consolidated:

 (-----(-------------)-(-----)----------------)      (----(---)--------)



Your help is genuinely appreciated!

Best,
Nabarun

-----
Nabarun Dasgupta
Department of Epidemiology
Gillings School of Global Public Health
& Injury Prevention Research Center
University of North Carolina
Chapel Hill, NC 27599 USA


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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