Search code examples
spss

SPSS: Save results of statistical comparison as a new variable


I'm using a large SPSS dataset of exam results, with variables called TotalScore (scale) and PassFail (nominal), and around 14,000 other "item" variables (nominal, 1 = Correct and 0 = Incorrect). I'm trying to run a T-Test between TotalScore and each of the items, as well as a chi square on each of the items and PassFail.

The part I am seeking help on is saving the results of each of those statistical comparisons, either as a new variable or in a new dataset. Ultimately I'm looking to be able to identify which of the items are most related to TotalScore and PassFail.

I tried using OMS Control panel (so I have syntax that runs the T-test and then it outputs the table into a new dataset) and that works great, EXCEPT the OMS doesn't include the Grouping variable! It seems to list the index of the Table within the output, but considering that I have a few thousand tables, this isn't much help.

Is there a way to get the Grouping variable included in the OMS output? Or perhaps a way to cross-reference the table index in a different output? And if you have a better idea than using the OMS, that would be great too!

Thank you for your help and overlooking the really unsound statistical approach. Cheers


Solution

  • A simple workaround: is to create a new variable, say "grouping", to split the file by "grouping", and then before each run of the ttest, compute the name of the grouping variable into "grouping".
    This will put the value of "grouping" (the name of the grouping variable) into "var1" in the OMS output data.

    assuming you are using a macro or a python program to automatically run all the t-tests, it would go something like this:

    string grouping (a10).
    split file by grouping.
    *start loop
    *compute grouping=[name of next var to be used for grouping]
    *ttest [using name of next grouping variable]
    *end loop