I want to generate a composite variable “ppe” from 10 variables which have been coded 0 “no” & 1 “yes” but with missing data. The composite variable should reflect the number of answered questions e.g.
S.no | var1 | var2 | var3 | var4 | var5 | var6 | var7 | var8 | var9 | var10 | ppe |
1 | 0 | 1 | 0 | 1 | 1 | 1 | . | 0 | 1 | . | 8 |
2 | 1 | . | . | . | 1 | 1 | 1 | 1 | 0 | 0 | 7 |
The values in column labled ppe is the answers I expect. What is the correct script to do this? Thank you in advance
0 Response to Generating a composite variable to reflect the number of answered questions
Post a Comment