Column sum in SPSS (with filter and grouped by date)?

device      date     act power 1     react power 2
-------------------------------------------------
M1         05-02            2              3
M2         05-02            4              2    
M3         05-02            3              4
M1         06-02            1              2
M2         07-02            3              4
                     -------        -------
                    need sum       need sum

Say that I only need the sum of M1 and M2 from that table. How could I add a variable that contains the sum of power group by date and device?

I don't know if it is desired to have something like this? Or how can I use descriptive statistics to filter away the other devices just to have M1 and M2 only.

device      date     SUM (actpower1)     SUM(reactpower2)
-------------------------------------------------
M1+M2      05-02            6              5


```

Topic automatic-summarization spss data

Category Data Science


Disclaimer - not a statistician, just a doctor without a statistician struggling through research

Had this same issue with wanting to sum certain cells within the same columns, but total number of cases were in excess of 1 million so couldn't use Excel. I couldn't find any answers online that didn't involve writing my own code (which I don't know how to do) or computing a new variable.

Finally figured out that you can use "Custom Tables" to generate this info. Change the default "mean" to "sum" using the "Summary Statistics" button. Will adjust based on the cases selected. Gave me exactly what I needed.


Normally such operations are done in Excel (click into an empty cell and type =Sum( select the column of which you want to calculate the cumulative sum and then close the bracket ). Finally, hit enter). Note that the sum is only a global metric. It will not be a local measure for each observation that you have.

If you want to get these sums in SPSS you can use the descriptive statistics or you can also use the following syntax CREATE CUMMULATIVESUM=CSUM(OLDVAR). This will generate the cumulative sum for your observations. The entry for your last observations will be the sum of all observations.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.