Hi family,
I have multiples choice question that I splited them into 4 variable base on the command I came across, with a yes for option that were chosen and for the choice that were not chosen it indicates as missing response since that was not selected.
example,
saq4: Select the source of the information(Multiple response)
A. School(Selected)
B. Home.
C. Television(selected)
D. Other
So in column saq4= AB as text
After conversion,
using the command below that i came across;
foreach j in A B C D{
gen saq4`j'=regexm(saq4,"`j'")
recode saq4`j' (0=.)
la val saq4`j' yn
}
lab var saq4A "Does not visit home regularly"
lab var saq4B "Does not answer calls"
lab var saq4C "Does not attend social events"
lab var saq4D "No development"
I got four(4) additional newly created variable with response as seen below;
saq4A saq4B saq4C saq4D
yes . yes .
example of the structure after conversion, the rest,
OS. saq4A saq4B saq4C saq4D
1 . Yes . yes
2. yes . . .
.
.
.
20. . yes yes yes
I used the command
mrtab saq4A saq4B saq4C saq4D
Though I got some statistics but I was not too sure.
Because the examples that I came across, they used 0 for no and 1 as yes but in my case I have missing(.) as no and yes for the responses.
Can you please confirmed for me
I attached example data set for your perusal.
. dataex
----------------------- copy starting from the next line -----------------------
I would be glad if there is also another easy way to handle it I will appreciate that.
Thank you.
Sham.
I have multiples choice question that I splited them into 4 variable base on the command I came across, with a yes for option that were chosen and for the choice that were not chosen it indicates as missing response since that was not selected.
example,
saq4: Select the source of the information(Multiple response)
A. School(Selected)
B. Home.
C. Television(selected)
D. Other
So in column saq4= AB as text
After conversion,
using the command below that i came across;
foreach j in A B C D{
gen saq4`j'=regexm(saq4,"`j'")
recode saq4`j' (0=.)
la val saq4`j' yn
}
lab var saq4A "Does not visit home regularly"
lab var saq4B "Does not answer calls"
lab var saq4C "Does not attend social events"
lab var saq4D "No development"
I got four(4) additional newly created variable with response as seen below;
saq4A saq4B saq4C saq4D
yes . yes .
example of the structure after conversion, the rest,
OS. saq4A saq4B saq4C saq4D
1 . Yes . yes
2. yes . . .
.
.
.
20. . yes yes yes
I used the command
mrtab saq4A saq4B saq4C saq4D
Though I got some statistics but I was not too sure.
Because the examples that I came across, they used 0 for no and 1 as yes but in my case I have missing(.) as no and yes for the responses.
Can you please confirmed for me
I attached example data set for your perusal.
. dataex
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int zabea_id str4 saq4 str6 saq5 1 "D" "ABCDE" 2 "D" "ABCDE" 3 "D" "ABCDE" 4 "BD" "BDE" 5 "BCD" "ABCDE" 6 "CD" "BDE" 7 "D" "BDEF" 8 "D" "C" 9 "D" "ADEF" 10 "D" "DE" 11 "D" "DE" 12 "A" "DF" 13 "D" "DE" 14 "D" "DF" 15 "D" "DF" 16 "D" "ABCDE" 17 "D" "ABCDE" 18 "D" "ABCDE" 19 "A" "ABCDEF" 20 "D" "ABCDE" 15 "D" "ABCDE" end
I would be glad if there is also another easy way to handle it I will appreciate that.
Thank you.
Sham.
Comment