Hi,
I apologise in advance for my extremely novice coding question, but it has been some time since I last worked with Stata and I haven't been able to find a proper answer to my question through general online searching.
Basically, I would like to create a dichotomous variable (dummy1) which equates to 1 if at least one of my 7 4-point likert scale-type variables equates to the value label of 1 i.e catvar1==1. Each of these likert variables have been coded in the exact same way.
I've attempted to produce this variable by coding:
dummy1=0
replace dummy1=1 if catvar1==1 | catvar2==1 | catvar3==1 | catvar4==1 | catvar5==1 | catvar5==1 | catvar1==1
My problem, however, is that I'm unsure if this is the correct code to use in order to create my desired variable. The output I receive when I cross-tabulate dummy1 with the various likert variables doesn't seem to match.
Any assistance to provide some clarity on what the best code to use in this situation would be very appreciated!
Thank you in advance for any time taken to address this seemingly simple question.
Michaella
I apologise in advance for my extremely novice coding question, but it has been some time since I last worked with Stata and I haven't been able to find a proper answer to my question through general online searching.
Basically, I would like to create a dichotomous variable (dummy1) which equates to 1 if at least one of my 7 4-point likert scale-type variables equates to the value label of 1 i.e catvar1==1. Each of these likert variables have been coded in the exact same way.
I've attempted to produce this variable by coding:
dummy1=0
replace dummy1=1 if catvar1==1 | catvar2==1 | catvar3==1 | catvar4==1 | catvar5==1 | catvar5==1 | catvar1==1
My problem, however, is that I'm unsure if this is the correct code to use in order to create my desired variable. The output I receive when I cross-tabulate dummy1 with the various likert variables doesn't seem to match.
Any assistance to provide some clarity on what the best code to use in this situation would be very appreciated!
Thank you in advance for any time taken to address this seemingly simple question.
Michaella
Comment