0
$\begingroup$
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


```
$\endgroup$
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Yeah I would like to use excel, the problem is this dataset has over 1 million rows. That is why I wanted to know if I can sum columns but filtering some rows (filter based on device as you saw). Thanks a lot for the quick response! $\endgroup$ – Daniel Rivas May 8 '19 at 20:31
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.