Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: R: Gen & replace


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: Gen & replace
Date   Fri, 2 Nov 2007 10:20:10 +0100

Dear Ziad,

I would advise you to try what follows (although it is not that efficient):


gen drugsum= drug1+ drug2 +drug3 +drug4 +drug5 if   drug1| drug2 | drug3|
drug4| drug5 !=0
            
HTH and Kind Regards,

Carlo
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Ziad El-Khatib
Inviato: gioved� 1 novembre 2007 23.19
A: [email protected]
Oggetto: st: Gen & replace

Dear STATA lister
it might be simple question, but spent sometimes on it so far.
I want to calculate sum of missed pills on 3 out of 5 drugs (drug1,
drug2..drug5).
Main drugs are drug1 and drug2, and the combination is either:
adherence level of:
drug1 + any 2 out of drug3,4,5
or
drug2 ?  any 2 out of drug3,4,5

All of these drugs have value 0 when they were not used.

i thought first to add them by typing
gen drugsum = drug1+drug2+drug3+drug+4drug5
I assume i will get total sum, but when i do ratio, STATA count with
patients with dug value 0.

Any tips how to exclude counting patients with drug value = 0?


Thank you in advance and best regards
ziad
*
*   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/


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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index