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

st: R: Gen & replace

From   "Carlo Lazzaro" <>
To   <>
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,

-----Messaggio originale-----
[] Per conto di Ziad El-Khatib
Inviato: giovedý 1 novembre 2007 23.19
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,
Main drugs are drug1 and drug2, and the combination is either:
adherence level of:
drug1 + any 2 out of drug3,4,5
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
*   For searches and help try:

*   For searches and help try:

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