I am trying to generate a new variable to take on the values of 1 and 0. Where 1 represents alcohol abuse and 0 no alcohol abuse.
My variables are:
Alc is a variable which has information for alcohol consumption
gender takes the value of 0 and 1 for male and female respectively
for female, alcohol abuse the condition is equal or greater than 2.
Will I be right to specific the command as below:
Clyde Schechter
My variables are:
Alc is a variable which has information for alcohol consumption
gender takes the value of 0 and 1 for male and female respectively
for female, alcohol abuse the condition is equal or greater than 2.
for male, alcohol abuse the condition is equal or greater than 3.
Will I be right to specific the command as below:
Code:
gen ABI = 0
Code:
replace ABI =1 if alc >=3 & gender ==1
Code:
replace ABI =1 if alc >=4 & gender ==0
Comment