Hello,
am working on assignment 4 question 4. based on review of lecture notes and stata help, i'm still having trouble with the syntax for the generate command. I did figure it out with the recode command but it seems like generate should work too, would love some help with the syntax.
I want to create a new variable, age50, which is 0 when age<50 and 1 when age 50 or greater. so, I have tried multiple versions:
gen age50 = (0 if age<50 & 1 if age>=50)
gen age50 = 0 if age<50 & 1 if age>=50
if i generate age50 with just one of the conditions, e.g. = 0 if age<50, then i create a bunch of missing data which I could replace with 1 I suppose, but this seems inelegant. I can't figure out the right syntax for the command to give it two conditions.