Calculate average percent score
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | * I have a scale with 47 items, with responses of 0 or 1. Each item has a different weight, ranging from 9.16 to 13.51. Each weight is then multiplied by 0 or 1, depending on the response. The resulting total of these products is divided by the grand total of all the possible weights (544.76) to compute a percentage score. *My question concerns how to adjust the grand total of the weights when one or more of the responses is missing. For example, if a case is missing an item with a weight of 11.55, I want to subtract this weight from 544.76, so that the grand total of all possible weights for this case is 533.21. If two items are missing, I want to subtract both of their weights from 544.76. *I would like to write syntax that would determine which items are missing for each case and subtract the corresponding weight(s) from the grand total in some kind of automated manner. Any suggestions would be welcome. * This answer was posted on 2000/10/23 by Raynald Levesque to SPSSX-L. DATA LIST LIST /s1 TO s3 w1 TO w3. BEGIN DATA 1 1 1 0 1 0 . 1 . 0 0 0 1 1 0 END DATA. LIST. * Assign the weighs. COMPUTE w1=9. COMPUTE w2=11. COMPUTE w3=10. *Check which scores exist. VECTOR s=s1 TO s3. VECTOR exist(3F1.0). LOOP #cnt=1 TO 3. COMPUTE exist(#cnt)=~SYSMIS(s(#cnt)). END LOOP. *Calculate maximum weight of scores which exists. VECTOR w=w1 TO w3. VECTOR maxw(3F3.2). LOOP #cnt=1 TO 3. COMPUTE maxw(#cnt)=w(#cnt)*exist(#cnt). END LOOP. *Calculate actual score. VECTOR score(3F3.2). LOOP #cnt=1 TO 3. COMPUTE score(#cnt)=s(#cnt)*w(#cnt). END LOOP. *Calculate average percentage score. COMPUTE pcscore=SUM(score1 TO score3)/SUM(maxw1 TO maxw3). EXECUTE. |
Related pages
...