I need some help on how to generate a new variable with various conditions. The new variable is anyone who has been diagnosed with hcc at any visit other than 1 so the syntax below is what i wrote:
generate probableHCConFUP=.
replace probableHCConFUP=1 if hcc1==0 & hcc2==1| hcc3==1| hcc4==1| hcc5==1| hcc6==1| hcc7==1| hcc8==1| hcc9==1| hcc10==1
The issue I am having is trying to get the 'probableHCConFUP=0' part; this should be the number of people without a diagnosis of hcc at any visit.
I have tried replace probableHCConFUP=0 if hcc1==0 |hcc2==0| hcc3==0| hcc4==0| hcc5==0| hcc6==0| hcc7==0| hcc8==0| hcc9==0| hcc10==0 but this doesn't work. I have also tried doing it with each visit separately but i still don't get the right number.
To note is the fact that someone may be diagnosed with hcc at one visit but not the other. the numbers after hcc denote the visit numbers.
Kindly help as I'm not sure what I am missing.
generate probableHCConFUP=.
replace probableHCConFUP=1 if hcc1==0 & hcc2==1| hcc3==1| hcc4==1| hcc5==1| hcc6==1| hcc7==1| hcc8==1| hcc9==1| hcc10==1
The issue I am having is trying to get the 'probableHCConFUP=0' part; this should be the number of people without a diagnosis of hcc at any visit.
I have tried replace probableHCConFUP=0 if hcc1==0 |hcc2==0| hcc3==0| hcc4==0| hcc5==0| hcc6==0| hcc7==0| hcc8==0| hcc9==0| hcc10==0 but this doesn't work. I have also tried doing it with each visit separately but i still don't get the right number.
To note is the fact that someone may be diagnosed with hcc at one visit but not the other. the numbers after hcc denote the visit numbers.
Kindly help as I'm not sure what I am missing.
Comment