Hello,
in a dataset on health issues I have several single variables with a binary yes/no option. It pretty much looks like this.
"Do you have psychosocial issues?" --> Yes 40 No 30
"Do you have kardiological issues?" --> Yes 20 No 50
"Do you have neurological issues?" --> Yes 50 No 20
and so on with 4 more variables with different health issues. All variables have the same number of observations (N=70) with no missings in the dataset.
I want to combine all of these to one variable containing only the "yes" answers. It should look like this
"Which health issues do you have?"
Psychological 40
Cardological 20
Neurological 50
and so on
I know that this will increase the number of observation as this will be a multiple choice variable, where people can have psychological AND cardiological issues, but that is fine for me.
I was able to combine the variables with the following command, but this does not consider all answers given, but only one for each person that has answered the questionaire
gen indikation =.
replace indikation = 1 if indpsycho == 1
replace indikation = 2 if indcardio == 1
replace indikation = 3 if indneuro == 1
and so on
If someone has answered yes (1) in the psychological AND the cardiological question, they will be first considered in the variable "indikation" with option 1 and then replaced with the second command line to option 2. But what I want is that they should appear in both options. So there should be something like "add" instead of "replace".
Is there a way to manage this in stata? Thanks for your answers
in a dataset on health issues I have several single variables with a binary yes/no option. It pretty much looks like this.
"Do you have psychosocial issues?" --> Yes 40 No 30
"Do you have kardiological issues?" --> Yes 20 No 50
"Do you have neurological issues?" --> Yes 50 No 20
and so on with 4 more variables with different health issues. All variables have the same number of observations (N=70) with no missings in the dataset.
I want to combine all of these to one variable containing only the "yes" answers. It should look like this
"Which health issues do you have?"
Psychological 40
Cardological 20
Neurological 50
and so on
I know that this will increase the number of observation as this will be a multiple choice variable, where people can have psychological AND cardiological issues, but that is fine for me.
I was able to combine the variables with the following command, but this does not consider all answers given, but only one for each person that has answered the questionaire
gen indikation =.
replace indikation = 1 if indpsycho == 1
replace indikation = 2 if indcardio == 1
replace indikation = 3 if indneuro == 1
and so on
If someone has answered yes (1) in the psychological AND the cardiological question, they will be first considered in the variable "indikation" with option 1 and then replaced with the second command line to option 2. But what I want is that they should appear in both options. So there should be something like "add" instead of "replace".
Is there a way to manage this in stata? Thanks for your answers
Comment