Search code examples
statisticsspss

Running an analysis separately for every category of a variable


I want to recreate the following table using my own dataset.

Table 5, Greenberg et al., Bronchopulmonary dysplasia

Note that there is a p-value for every row (in this case every medication), based on Fisher's exact test. I take this to mean the p-value for the association between the individual medication and BPD.

When I try to run Fisher's exact test in SPSS, I get a p-value for the whole table.

Assume I have a dataset showing all my patients, with a column on whether they receieved a specific drug coded as yes/no, and a column on whether they had BPD coded as yes/no. How do I get SPSS to test every medication individually against BPD?

For those with access, the full paper is here.


Solution

  • Splitting the data by medication should do the trick -

    sort cases by medicationName.
    split file by medicationName.
    ...your analysis command here...
    split file off.