Hello all, I'm a relatively new Stata user.
I have a set of variables that are the responses to a survey, and I need to create a variable that sums up the score. This wouldn't be a problem if my variables were set up as "traditional" dummy variables (1=correct, 0=not correct, .=missing/refusals) as I would use
but unfortunately they are coded differently: 1=correct, 2=not correct, while missing/refusals are -9 and -8. Of course, if I use the command above, I get wonky results that don't range between 0 and 5 like I want them to.
Is there any way I can create my sum variable, without having to recode all the variables (so that 1=correct, 0=not correct, .=missing/refusals)?
Thank you for your help.
I have a set of variables that are the responses to a survey, and I need to create a variable that sums up the score. This wouldn't be a problem if my variables were set up as "traditional" dummy variables (1=correct, 0=not correct, .=missing/refusals) as I would use
Code:
egen total=rowtotal(var1 var2 var3 var4 var5)
Is there any way I can create my sum variable, without having to recode all the variables (so that 1=correct, 0=not correct, .=missing/refusals)?
Thank you for your help.
Comment