SPSS Statistics

 View Only
  • 1.  Aggregate function error string variable

    Posted Mon March 13, 2023 05:54 AM

    This is my syntax:

    AGGREGATE
        /OUTFILE=*MODE=ADDVARIABLES
        /BREAK=subjID
        /Responded_sum=SUM(Responded)
        

    I get the error that this has been used with a string variable not a numeric (see printscreen)
    However, this variable is set as 'scale' and when I check with Data - define variable properties it also says numeric. So what is the problem?



    ------------------------------
    Renee Damstra
    ------------------------------


  • 2.  RE: Aggregate function error string variable

    Posted Mon March 13, 2023 08:34 AM

    aggregate outfile=* /break subjid /responded_sum=sum(responded)



    ------------------------------
    Art Jack
    ------------------------------



  • 3.  RE: Aggregate function error string variable

    Posted Mon March 13, 2023 10:34 AM

    I am sorry, do you mean I have to use your command/formula instead? Would this then add a new variable since you have seemed to remove this part? 



    ------------------------------
    Renee Damstra
    ------------------------------



  • 4.  RE: Aggregate function error string variable

    Posted Mon March 13, 2023 10:58 AM

    That's how the aggregate function works.  You break on specific variables and create others.  



    ------------------------------
    Art Jack
    ------------------------------



  • 5.  RE: Aggregate function error string variable

    Posted Mon March 13, 2023 11:34 AM
    1. In Aantal tellen fout.jpg you try to create a variable "Responded-sum". A "-" (dash) is not allowed in variable names, so you get two errors: "Responded" already exists, "-" is an invalid symbol in this place. With "_" (underscore, like you wrote in your post) the command would succeed.
    2. There is no "error string variable" in your screenshot. The break variables in aggregate may be either numeric or string.
    3. Omission of the OUTFILE subcommand is equivalent to OUTFILE=* MODE=ADDVARIABLES. So you can leave out this line.


    ------------------------------
    forplan Statistik
    ------------------------------