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: Creating drugs combination


From   Michele Santacatterina <[email protected]>
To   [email protected]
Subject   st: Creating drugs combination
Date   Thu, 13 Sep 2012 17:39:59 +0200

Dear StataList,

I have an issue. I am trying to create, from a HIV database, a variable containing the value of different drug combinations (name regimen) and the number of drugs (number of drugs)$

ID      treatstart      treatstop       drug            name_regimen    number_of_drugs
2       24-Aug-95       14-Nov-97       ZDV             ZDV+3TC                 2
2       24-Aug-95       13-Feb-03       3TC
2       7-Aug-96        14-Nov-97       LOV             ZDV+3TC+LOV             3
2       14-Nov-97       15-Jun-00       IDV             3TC+IDV+d4T             3
2       14-Nov-97       13-Feb-03       d4T
2       15-Jun-00       13-Feb-03       IDV             3TC+IDV+RTV             3
2       15-Jun-00       13-Feb-03       RTV

Patient 2 started ART at 24-Aug-95 with ZDV+3TC and at 7-Aug-96, LOV was added to the treatment becoming ZDV+3TC+LOV. At 14-nov-97 he finished with ZDV and LOV and he started with $

If I run the command 

by infcare_ID treatstart, sort: gen n_trt = _n

for the number of drugs, i obtain at 7-Aug-96 just one drug (LOV) and not 3 as I should have (ZDV+3TC+LOV).

Hoping I have been clear enough.
Someone knows how to do it?

Thank you in advance.

Michele



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