SPSS Statistics

  • 1.  Help - Compute a Variable

    Posted Mon October 18, 2021 09:44 AM
    I am trying to compute a variable using Compute or Aggregate and am not sure the best way to do it. I have three variables and want to take the %9/10 from each of the 3 variables and then take the straight average. Please advise on the best way to do this...

    ------------------------------
    Jessica McGregor
    ------------------------------


  • 2.  RE: Help - Compute a Variable

    Posted Mon October 18, 2021 09:56 AM
    Hi, Jessica. I'm sorry, I'm not clear on "%9/10" part. I assume that you have seen AGGREGATE's functions such as PIN (percent in), which is coming to mind, but before I recommend anything I need to better understand exactly what you're wanting.

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



  • 3.  RE: Help - Compute a Variable

    Posted Mon October 18, 2021 02:54 PM
    So I have 3 variables in my file. Each variable has responses that range from 0 - 10. I'd like to calculate the % of respondents that picked a 9 or a 10 for each of the 3 variables - so say V1 = 70%, V2 = 25% and V3 = 76%, and then take the straight average of those %'s - so (70%+25%+76%)/3 = 57%. Hopefully this helps! THANKS so much.

    ------------------------------
    Jessica McGregor
    ------------------------------



  • 4.  RE: Help - Compute a Variable

    Posted Mon October 18, 2021 03:18 PM
    So I mocked up some simple data to give an example of what it sounds like you want:

    data list free /x1 x2 x3.
    begin data.
    10 6 9
    3 9 9
    9 5 8
    10 9 9
    5 7 10
    3 6 1
    2 10 2
    10 5 3
    9 1 5
    1 10 6
    end data.
    
    compute x=1.
    aggregate /outfile=* /break=x /p1 to p3=pgt(x1 to x3 8). 
    compute avg=mean(p1 to p3).
    list.
    ​

    That should do it. Just substitute your variables for the "x1 to x3". If they aren't contiguous in the file like that, then just list them individually.



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