SPSS Statistics

SPSS Statistics

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

 View Only
  • 1.  Problem with computing variable

    Posted Fri April 08, 2022 10:37 AM

    I ran syntax but somehow, the data was not correct. Did I code it right?

    My case scenario is (Sui_AA has 1, 2 , 3 categories, Sui_BB has 1, 2 categories, Sui_CC has 1, 2 categories)

    I wanted to create group with conditions given below

    Group 1 = If Sui_AA, Sui_BB and Sui_CC=1

    Group 2 = only Sui_AA is 2 and 3

    Group 3= only Sui_BB is 2

    Group 4= both Sui_AA is 2 and 3 and Sui_BB is 2

    Group 5 = Sui_CC is 2

    if a case in Sui_CC has 2 then s/he belongs to group 5 irrespective of answer in Sui_AA and Sui_BB

    Each case can belong to only one group

    Incase of missingness in if Sui_CC is 2, s/he is included but if the case has missing values in Sui_AA and Sui_BB but no answer in Sui_CC then excluded.

    All questions should be dichotomized 1 and 2

    The codes I ran now x.......................................................................................x

    if(Sui_AA=1 | Sui_BB=1 | Sui_CC=1) group1 = 1.

    if(Sui_AA=2 | Sui_AA=3 | Sui_BB=1 | Sui_CC=1) group2 = 1.

    if(Sui_AA=1 | Sui_BB=2 | Sui_CC=1) group3 = 1.

    if(Sui_AA=2 | Sui_AA=3 | Sui_BB=2 | Sui_CC=1) group4 = 1.

    if(Sui_CC=2) group5 = 1.

    EXECUTE.

    I hope you could help me.

    Thanks



    ------------------------------
    san sil
    ------------------------------

    #SPSSStatistics


  • 2.  RE: Problem with computing variable

    Posted Fri April 08, 2022 11:57 AM
    Hi.

    The vertical bar means "OR". Is that what you really want in all these cases, or is "AND" what you might want in some of them? I'm thinking of Group 1 in particular.

    f(Sui_AA=1 | Sui_BB=1 | Sui_CC=1) group1 = 1.

    means

    AA= 1 OR BB = 1 OR CC = 1, then group1 =1.

    But your condition:

    Group 1 = If Sui_AA, Sui_BB and Sui_CC=1

    has "AND" in it. Same elsewhere. Where you have "AND" maybe you need to re-think your use of "OR".

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