Hi there,
I have a variable called lop and another variable called age
I would like to generate a new variable, called age_tied_to_lop, where AGE only has a value if LOP has a value (ie, if LOP = . then I also want my age_tied_to_lop to be coded as missing .)
I tried the following code, but its not really working:
gen age_tied_to_lop = .
replace age_tied_to_lop = age if lop>0
But I don't want to replace if lop>0; I want to replace only if lop actually has a value (ie, is any value other than .)
Thanks for any help
I have a variable called lop and another variable called age
I would like to generate a new variable, called age_tied_to_lop, where AGE only has a value if LOP has a value (ie, if LOP = . then I also want my age_tied_to_lop to be coded as missing .)
I tried the following code, but its not really working:
gen age_tied_to_lop = .
replace age_tied_to_lop = age if lop>0
But I don't want to replace if lop>0; I want to replace only if lop actually has a value (ie, is any value other than .)
Thanks for any help
Comment