SPSS Statistics

 View Only
  • 1.  COMPUTE syntax help

    Posted Wed January 24, 2024 05:17 PM

    I am getting the error "the expression ends unexpectedly" on the following syntax:

    COMPUTE ACE_ABUSE=((ACEHURT1=2|3)|(ACESWEAR=2|3)|(ACETOUCH=2|3)|(ACETTHEM=2|3)|(ACEHVSEX=2|3)) ACE_ABUSE=2.
    COMPUTE ACE_ABUSE=((ACEHURT1=1) and (ACESWEAR=1) and (ACETOUCH=1) and (ACETTHEM=1) and (ACEHVSEX=1)) ACE_ABUSE=1.
    COMPUTE ACE_ABUSE=((ACEHURT1=7|9) and (ACESWEAR=7|9) and (ACETOUCH=7|9) and (ACETTHEM=7|9) and (ACEHVSEX=7|9)) ACE_ABUSE=3.
    EXECUTE.

    The labels for all 5 variable are 

    1 Never, 2 Once, 3 More than once, 7, Don't know, and 9 Refused; I am trying to make one variable where 2 includes any yes on any variable, No includes No on all 5 variables and 3 is everything else.  Any help is appreciated.



    ------------------------------
    Nicole Ayres
    ------------------------------


  • 2.  RE: COMPUTE syntax help

    IBM Champion
    Posted Wed January 24, 2024 05:34 PM
    This is not valid syntax:
    ACEHURT1=2|3
     You would need to write 
    ACEHURT1 = 2 | ACEHURT1 = 3
    etc
    or use the any function:
    ANY(ACEHURT1, 2,3)

    --