Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Phil Schumm <pschumm@uchicago.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Handling pharmacy data with multiple entries per subject |

Date |
Mon, 13 Jun 2011 11:15:25 -0500 |

On Jun 10, 2011, at 5:05 PM, Doernberg, Sarah wrote:

Thank you for your responses. I'm attempting to be more specificabout my question below. My data is currently formatted as follows(with an example entry):ID drug_name start_date stop_date outcome 1 ceftriaxone 5/15/2001 5/17/2001 5/31/2001 1 ceftriaxone 5/19/2001 5/20/2001 5/31/2001 1 ceftriaxone 5/20/2001 5/24/2001 5/31/2001 1 ceftriaxone 7/24/2001 7/27/2001 .This one person had 3 prescriptions for ceftriaxone during ahospitalization in May, 2001, including one day where the person wasnot given this drug (5/15-5/17 and 5/19-5/24). There was anotherhospitalization in July, 2001, where another prescription was given.The patient did not experience the outcome during the secondhospitalization. The dataset only contains information about twodifferent drugs.My ultimate goal is to figure out the number of days each personreceived each drug during a 30-day period from the first day ofreceipt or before the date of the outcome (if <30 days from thestart of antibiotic) to allow for a logistic regression withexposure = antibiotic days. In addition, I may also do a survivalanalysis using start of antibiotic as the start date, development ofthe outcome as failure, and censoring at 30 days in those withoutthe outcome.

ass start_date <= stop_date isid id drug_name start_date

expand stop_date - start_date + 1 bys id drug_name start_date: gen date = start_date if _n==1

gen fail = (outcome == date)

expand n, gen(added) replace date = outcome if added replace drug_name = "" if added replace fail = 1 if added

keep id drug_name date fail duplicates drop isid id date

Hopefully this'll give you some ideas/strategies that you can use. -- Phil * * 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/

**References**:**st: Handling pharmacy data with multiple entries per subject***From:*"Doernberg, Sarah" <Sarah.Doernberg@ucsf.edu>

**Re: st: Handling pharmacy data with multiple entries per subject***From:*Phil Schumm <pschumm@uchicago.edu>

**RE: st: Handling pharmacy data with multiple entries per subject***From:*"Doernberg, Sarah" <Sarah.Doernberg@ucsf.edu>

- Prev by Date:
**st: panel unit roots and cointegration** - Next by Date:
**st: Japanese Candlestick Charts** - Previous by thread:
**RE: st: Handling pharmacy data with multiple entries per subject** - Next by thread:
**st: Assistance on variable selection problem** - Index(es):