Using Stata 7SE:
Spend most of the weekend trying to get my data in the right format for a
stcox regression analysis with time-varying variables.
tried expand, stsplit and recode without getting it right:
I am looking at the possible impact of changing antibiotic treatment during
an episode of infection.
Here is an constructed example:
Most patients in the dataset are treated with a single antibiotic regimen
without changes, but others are changed to second-line antibiotic treatment
during the treatment course as a consequence of either toxicity or treatment
failure.
My data are recorded like this
id treat tx1 tx1end treat2 tx2 tx2end
1 pencillin 27oct1990 17nov1990
2 cefuroxime 12jun1993 05jul1993 vancomycine 05jul1993 11jul1993
3 pencillin 20feb1990 08mar1990
4 pencillin 31oct1991 02nov1991 cefuroxime 02nov1991 23nov1991
5 pencillin 01jun1989 12jun1989
6 pencillin 08dec1992 28dec1992
7 pencillin 15nov1994 06dec1994 cefuroxime 06dec1994 16dec1994
8 pencillin 12oct1989 23oct1989
I would somehow like to recode my data to get multiple records for the
patients who are switched with a split at the date of treatment change, like
this:
id treat date0 date1
1 pencillin 27oct1990 17nov1990
2 cefuroxime 12jun1993 05jul1993
2 vancomycine 05jul1993 11jul1993
Any suggestions?
Jannik Helweg-Larsen
Copenhagen
Denmark
*
* 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/