SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Crosstabs with condition

    Posted Fri February 10, 2023 09:30 AM

    Dear group,

    I am just a newbie with SPSS and I hope I'll be forgiven if my question doesn't sound like "linear" but till some days ago my mind was used to work in a "programming language paradigm".

    I am using the function Analysys -> Crosstabs and I can get a nice contigency grid for my Gender patient (binomial) * My category(binomial).

    Now I'd like to add an extra layer: I'd like to split, for each My category, if My variable is => 10 or < 10.

    I've tried to create an extra var with a conditional content but I'm still need to get into the process of SPSS...

    Hope to find someone who will be able to help me with kindness :)

    Wish you a nice day!



    ------------------------------
    N P
    ------------------------------


  • 2.  RE: Crosstabs with condition

    Posted Fri February 10, 2023 10:34 AM

    Hi. Try this.

    In syntax:

    COMPUTE Group=(My_Variable GE 10).

    EXECUTE.

    Then in the Crosstabs dialog:



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



  • 3.  RE: Crosstabs with condition

    Posted Fri February 10, 2023 11:38 AM

    Hi Rick Marcantonio and thank you for you're really prompt answer.

    I ignored the existence of the synxtax function...

    Can I create this kind of virtual groups just by the UI or I need to pass by syntax modality?

    It looks like way similar to R Studio.

    I'll have a look to this new programming language



    ------------------------------
    N P
    ------------------------------



  • 4.  RE: Crosstabs with condition

    Posted Fri February 10, 2023 11:41 AM

    I find it easier to do in syntax. However, you can use the UI:

    Transform > Compute Variable...



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



  • 5.  RE: Crosstabs with condition

    Posted Fri February 10, 2023 06:32 PM

    Thank you once again, Rick Marcantonio.

    As you suggested it may work but I'm making things a bit more complex.

    I'd like to generate a var that contains a value according to other two variables (Ddimero and Cutoffddimeroforage) into the dataset.

    I tried with syntax but I'm making some mistake, don't know where...

    IF (Ddimero >= Cutoffddimeroforage).
    COMPUTE DDimeroAdj=0.
    ELSE.
    COMPUTE DDimeroAdj=1.
    EXECUTE.
    

    There's a way to make this by UI?



    ------------------------------
    N P
    ------------------------------



  • 6.  RE: Crosstabs with condition

    Posted Fri February 10, 2023 08:47 PM

    You needed DO IF, not IF:

    DO IF (Ddimero >= Cutoffddimeroforage).

    COMPUTE DDimeroAdj=0.

    ELSE.

    COMPUTE DDimeroAdj=1.

    EXECUTE.

    Although, with something so simple, you just do:

    COMPUTE DDimeroAdj=1.

    IF (Ddimero >= Cutoffddimeroforage) DDimeroAdj=0.

    This will do the same through the UI:

    Transform > Compute Variable...

    Press OK. Go back to Transform > Compute Variable...

    Then press If...

    Then click Continue, then OK.

    That should do it.



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