[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: generating a new variable from 3 binary variables
If I understand you correctly, the following will do what you want:
gen byte sth=.
replace sth=1 if HOOK==1 | ASCA==1 | TRICH==1
replace sth=2 if HOOK==2 & ASCA==2 & TRICH==2
Rich
[email protected] wrote:
Dear all,
I am a new STATA user. I recently worked with SAS in the past.
I am working with 3 variables, all of which are binary (1 or 2).
I am having some complications generating a new variable, called STH
(also binary).
STH needs to equal 1 if the variables HOOK, ASCA or TRICH=1.
Any combination will do as long as one of the 3 variables is equal to 1.
In addition, STH needs to equal 2 when HOOK, ASCA and TRICH=2. No
combinations are permitted.
Any help on this would be greatly appreciated.
Layla
*
* 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/