Dear list members,
I have a huge (250 items) data set from multiple choice items. The key to these items are stored in another file indicating the item name and key. Part of the data are as follows: Casenumb M3MX01MC03 M3MX01MC07 M3MX01MC21 M3MX01MC28 1 1 2 2 4 2 1 4 1 2 3 3 2 3 3 4 2 4 3 2 5 2 4 3 1 Key Itemname Key M3MX01MC03 1 M3MX01MC07 4 M3MX01MC21 3 M3MX01MC28 2 Is there a way I can use so as to score these items efficiently and achieve a 0 for incorrect and 1 for correct matrix? Thanks Ebby Ebby Madera, Ph.D., (Psychometrics) Data Management and Analysis Education Quality and Accountability Office 2 Carlton Street, Suite 1200 Toronto, Ontario, Canada M5B 2M9 Phone: 416-314-7965 Email: [hidden email] |
Ebby,
Variations on this general question have been discussed before. I think you have really three choices. 1) Copy the second (key file) into your syntax file and set about creating a long string of Compute and If statement sets, one for each variable. Like this Compute S_M3MX01MC03=0. If (M3MX01MC03 eq 1) S_M3MX01MC03=1. This code assumes NO missing data. This choice isn't very attractive because of the syntax overhead. 2) A better and easier method is to use Do repeat with the structure in 1). The trick here is that the correct answers are stored as the second variable. So you'll need to import and edit the second file. Do repeat x=M3MX01MC03 M3MX01MC07 M3MX01MC21 M3MX01MC28 ... / y=1 4 3 2 ... / z=S_M3MX01MC03 S_M3MX01MC07 S_M3MX01MC21 S_M3MX01MC28 ... . + Compute z=0. + If (x eq y) z=1. End repeat. 3) Another method is to read in the second file as a single record, append it to all the test records, and then score the file using either a Do repeat structure or a Loop structure. The difficulty here is the overhead of writing the code to read the second (key) file. This would be something like Data list file='...' records=250 / k_M3MX01MC03 17 / k_M3MX01MC07 17 / k_M3MX01MC21 17 / k_M3MX01MC28 17 ... Execute. Match files file='<your test response file>'/table=*. You'll note I have left off the By subcommand. I haven't done an operation like this recently and I may be misremembering that the By subcommand can be omitted. If it can't, there is a way around this, which is to define a new 'By' variable in both files such that every record has the same value before you do the Match files. Lastly, the Do repeat. Do repeat x=M3MX01MC03 M3MX01MC07 M3MX01MC21 M3MX01MC28 ... / y=k_M3MX01MC03 k_M3MX01MC07 k_M3MX01MC21 k_M3MX01MC28 ... / z=S_M3MX01MC03 S_M3MX01MC07 S_M3MX01MC21 S_M3MX01MC28 ... . + Compute z=0. + If (x eq y) z=1. End repeat. Ok, so there you go. I would choose 2) because I could edit the key file in word to pull the file into two parts: the variable names and the correct answers. Then, do a find and replace to append an 'S_' on the front of each variable and another find and replace to line them up in a list. Next, do a find and replace on the correct answer list to line it up in a list. Copy both lists into the Do repeat and run it. Gene Maguin |
Free forum by Nabble | Edit this page |