SPSS中两个变量/列的中位数

时间:2016-06-05 10:15:02

标签: variables multiple-columns spss median

我知道你可以在其他程序中轻松获得两个变量或列的中位数,但这在SPSS中是否可行?所以例如我有

measurement1 measurement2
1 2
1 2
1 1
2 3
5 4

我想要所有这些的中位数?所以我的答案应该是2。

1 个答案:

答案 0 :(得分:1)

就像@Andy W所说,这将完成这项工作:

*creating sample data.
DATA LIST list/measurement1 measurement2 .
begin data
1         2
1         2
1         1
2         3
5         4
end data.

* data restructure.
dataset name OrigData.
dataset copy Long.
dataset activate Long.
VARSTOCASES /make val from measurement1 measurement2/index=Measurment(val).

* now you can get your answer in the output window.
frequencies ‎‪val/STATISTICS=median.

* or in a separate dataset.
DATASET DECLARE YourAnswer.
AGGREGATE  /OUTFILE='YourAnswer'  /BREAK=  /val_median=MEDIAN(val).
dataset activate YourAnswer.