The non-mutually exclusive variables:
*cognition: (Yes=1, No=0)
*Frailty: (Yes=1, No=0)
*Depression (Yes=1, No=0)
*Anxiety (Yes=1, No=0)
*ADL_disability (Yes=1, No=0)
*IADL_disability (Yes=1, No=0)
I want to generate a new categorical variable inlcuding these several conditions:
gen synCondition:
0=none of these condtions
1=cognition alone or combined with other conditions
2=Frailty alone or combined with other conditions
3=Depression alone or combined with other conditions
4=Anxiety alone or combined with other conditions
5=ADL disability alone or combined with other conditions
6=ADL disability alone or combined with other conditions
I can not do like this:
gen synCondition=1 if cognition==1
replace synCondition=2 if Frailty==1
replace synCondition=3 if Depression==1
.....
Because in this way, the latter one replace the common condition with former one.
I think this question is very like the question: gen a new multi-categorical variable using non-mutually exclusive responses
But my goal is generate one categorical variable and make a bar chart (one graph which only show the percent of code=0, 1, 2, 3, 4, 5, and 6)
Thanks
*cognition: (Yes=1, No=0)
*Frailty: (Yes=1, No=0)
*Depression (Yes=1, No=0)
*Anxiety (Yes=1, No=0)
*ADL_disability (Yes=1, No=0)
*IADL_disability (Yes=1, No=0)
I want to generate a new categorical variable inlcuding these several conditions:
gen synCondition:
0=none of these condtions
1=cognition alone or combined with other conditions
2=Frailty alone or combined with other conditions
3=Depression alone or combined with other conditions
4=Anxiety alone or combined with other conditions
5=ADL disability alone or combined with other conditions
6=ADL disability alone or combined with other conditions
I can not do like this:
gen synCondition=1 if cognition==1
replace synCondition=2 if Frailty==1
replace synCondition=3 if Depression==1
.....
Because in this way, the latter one replace the common condition with former one.
I think this question is very like the question: gen a new multi-categorical variable using non-mutually exclusive responses
But my goal is generate one categorical variable and make a bar chart (one graph which only show the percent of code=0, 1, 2, 3, 4, 5, and 6)
Thanks
Comment