Statalist


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

Re: st: Gen & replace


From   n j cox <[email protected]>
To   [email protected]
Subject   Re: st: Gen & replace
Date   Fri, 02 Nov 2007 17:12:56 +0000

I am sure that I understand this but

drug3 != 0

will evaluate as 1 whenever -drug3- is not 0.

Thus you can count drugs by e.g.

gen c345 = (drug3 != 0) + (drug4 != 0) + (drug5 != 0)

Nick
[email protected]

Ziad El-Khatib
--------------------------------------------------------------------------------

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?

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