计算所有案例的总和

时间:2013-03-11 18:33:13

标签: spss

browser pageviews   month   totalhits percentage
-------------------------------------------------
ch     227025   Nov 2012    626760      36.22
ie     184232   Nov 2012    626760      29.39
s       81430   Nov 2012    626760      12.99
ff      72140   Nov 2012    626760      11.51
ie      39856   Nov 2012    626760      06.36
o        1010   Nov 2012    626760      00.16
rm        325   Nov 2012    626760      00.05
ot      20742   Nov 2012    626760      03.31

我有上面的数据集。我想根据总点击量来计算百分比。但是,我想根据综合浏览量的总和计算总点击次数。我如何总结多个案例?

在excell中,它会像SUM(网页浏览量)。

1 个答案:

答案 0 :(得分:2)

请参阅AGGREGATE命令。示例如下:

data list free /browser (A2) pageviews (F6.0)  month (A3) year (A4) totalhits (F6.0) percentage (F4.2).
begin data
ch     227025   Nov 2012    626760      36.22
ie     184232   Nov 2012    626760      29.39
s       81430   Nov 2012    626760      12.99
ff      72140   Nov 2012    626760      11.51
ie      39856   Nov 2012    626760      06.36
o        1010   Nov 2012    626760      00.16
rm        325   Nov 2012    626760      00.05
ot      20742   Nov 2012    626760      03.31
end data.

compute const = 1.
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=const
  /pageviews_sum = SUM(pageviews).
list vars = pageviews totalhits pageviews_sum.

在输出中返回:

pageviews totalhits pageviews_sum

  227025    626760     626760.0
  184232    626760     626760.0
   81430    626760     626760.0
   72140    626760     626760.0
   39856    626760     626760.0
    1010    626760     626760.0
     325    626760     626760.0
   20742    626760     626760.0