Calculating scores from variables if the variable have been answered

I have 5 variables var1, var2, var3, var4 and var5. They are all ordinal variables. I would to generate a variable that calculates the scores from these variables only if the variable has been answered. if all have been answered i will take var1+var2+var3+var4+var5. If 3 say var2, var3, var5 I will have var2+var3+var5…

Any idea?

Are you referring to single-select categorical questions?

You could use:

new[]{var1,var2,var3,....}.Sum()

May I ask what the underlying use case is?

1 Like

I want to calculate Positive and Negative Syndrome Scale (PANSS ) scores

1 Like