I want to generate a new dichotomous variable where 1 denotes the presence of one or more types of abuse - verbal abuse, sexual abuse, and physical abuse - and 0 denotes the absence of any abuse. Verbal abuse, sexual abuse, and physical abuse variables already exist. People could have experienced multiple forms of abuse. Would the code below work?
gen anyabuse=1 if verbal==1 | sexual==1 | physical==1
replace anyabuse=0 if anyabuse!=1
gen anyabuse=1 if verbal==1 | sexual==1 | physical==1
replace anyabuse=0 if anyabuse!=1

Comment