hi all,
I am pretty new to Stata and having difficulty figuring out the syntax for scoring a questionnaire so I thought I would ask here.
I have an instrument with 6 questions. For each question, I have converted the answers from string to a numerical value (example below)
generate brs_6=5 if itendtotakealongtimetogetoverset=="Strongly Disagree"
replace brs_6=4 if itendtotakealongtimetogetoverset=="Disagree"
replace brs_6=3 if itendtotakealongtimetogetoverset=="Neutral"
replace brs_6=2 if itendtotakealongtimetogetoverset=="Agree"
replace brs_6=1 if itendtotakealongtimetogetoverset=="Strongly Agree"
I would like to generate a new variable brs_total that sums the scores from question 1 through 6 (brs_1 to brs_6) for each observation.
I tried to use something like
foreach recordid {
generate brs_score = total (brs_1,brs_2,brs_3,brs_4,brs_5,brs_6)}
but this was definitely wrong.
It seems a deceptively easy task but I am unable to figure it out.
I would appreciate any and all guidance on this.
Thank you in advance!
I am pretty new to Stata and having difficulty figuring out the syntax for scoring a questionnaire so I thought I would ask here.
I have an instrument with 6 questions. For each question, I have converted the answers from string to a numerical value (example below)
generate brs_6=5 if itendtotakealongtimetogetoverset=="Strongly Disagree"
replace brs_6=4 if itendtotakealongtimetogetoverset=="Disagree"
replace brs_6=3 if itendtotakealongtimetogetoverset=="Neutral"
replace brs_6=2 if itendtotakealongtimetogetoverset=="Agree"
replace brs_6=1 if itendtotakealongtimetogetoverset=="Strongly Agree"
I would like to generate a new variable brs_total that sums the scores from question 1 through 6 (brs_1 to brs_6) for each observation.
I tried to use something like
foreach recordid {
generate brs_score = total (brs_1,brs_2,brs_3,brs_4,brs_5,brs_6)}
but this was definitely wrong.
It seems a deceptively easy task but I am unable to figure it out.
I would appreciate any and all guidance on this.
Thank you in advance!
Comment