SPSS Statistics

 View Only
  • 1.  Crosstab cells as variables

    Posted Thu December 16, 2021 07:49 AM
    I have run a 3x3 crosstab on two of my variables with each subject landing in one of the 9 cells. What is the quickest way to assign their cell as a variable so I can group them by cell and compare mean differences of other variables for those in each cell?

    Thanks so much in advance.

    ------------------------------
    Michael Sytsma
    ------------------------------

    #SPSSStatistics


  • 2.  RE: Crosstab cells as variables

    Posted Thu December 16, 2021 08:07 AM
    In this example, we save the XTAB output into a SAV file:
    * Created data for example.
    data list free /row col n.
    begin data.
    1 1 23
    1 2 13
    1 3 21
    2 1 35
    2 2 31
    2 3 15
    3 1 37
    3 2 43
    3 3 21
    end data.
    weight by n.
    
    * Use OMS to get cells.
    OMS SELECT TABLES /IF SUBTYPES='Crosstabulation'
     /DESTINATION FORMAT=SAV OUTFILE='/Users/rick/tmp/test.sav'.
    CROSSTABS
     /TABLES=row BY col /FORMAT=AVALUE TABLES /CELLS=COUNT
     /COUNT ROUND CELL.
    OMSEND.
    
    * Get that file and keep only what is needed.
    GET FILE '/Users/rick/tmp/test.sav' /drop Command_ to Label_ Var3.
    SELECT IF Var2 ne ''.
    EXECUTE.
    
    * If you want the cells all in one observation...
    
    CASESTOVARS /ID=Var1 /GROUPBY=VARIABLE.​



    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 3.  RE: Crosstab cells as variables

    Posted Fri December 17, 2021 04:47 PM
    THANKS!

    ------------------------------
    Michael Sytsma
    ------------------------------



  • 4.  RE: Crosstab cells as variables

    IBM Champion
    Posted Thu December 16, 2021 08:29 AM
    As you know, this question was answered on your identical Reddit post, but if you just want cell comparisons, consider using CTABLES to do this with the two variables as the rows and columns.  You might also do an ANOVA with those two variables.

    --