Stata Sum Ignore Missing. Qui foreach v of var vara varb varc replace total cond missing total v total v if missing v. This is because stata treats a missing value as the largest possible value e g positive infinity and that value is greater than 2 1 so then the values for newvar1 become 0.
Generate sum of variables ignore missing previous by thread. Generate sum of variables ignore missing. Gen total.
But is there an easy way to let stata read a missing value as 0 so that vara 1 varb.
Unfortunately the two programs you list in your tags spss and stata are two that i am not familiar with even to knowing whether this type of analysis is possible in those programs. The analysis could then be a multilevel ordinal logistic model. Generate sum of variables ignore missing. A solution from first principles is gen total 0 qui foreach v of var vara varb varc replace total total v if missing v notice that total ends up with 0 if all are missing.