SPSS中的3路CROSSTABS

时间:2009-09-10 12:26:37

标签: statistics crosstab spss

我在SPSS中有一些我希望以特定方式格式化的数据,但我似乎无法在文档中找到一种方法。

我的数据包含10个问题响应,Q1到Q10,变量SESSION中变量SPEAKER的每个值的Q1到Q10。例如,每个会话最多可以有五个发言者,对于会话1,我可能在Q1到Q10中有扬声器1和2的数据,但其他人没有。原始数据看起来像这样:

001A0123012301B0123012301C         D         E         

因此,会话001与扬声器A到E,其中A和B有数据(Q1到Q10,每个一列),其余的则没有。请注意,在Q1到Q10上只能有四个响应,而在下面我将标记这些R1,R2,R3和R4。希望这比你需要的更详细。

我想为每个会话生成一个看起来像这样的表:

Session 001
  Question | Speaker 1 | Speaker 2 | Speaker 3 | Speaker 4 | Speaker 5
       R1       10           15          0           0            0
   Q1  R2        9            4          0           0            0
       R3        0            1          0           0            0
       R4        2            0          0           0            0 
  ---------------------------------------------------------------------
       R1      ...
   Q2  R2      ...
       R3      ...
       R4      ...

文档似乎暗示

CROSSTABS Q1 TO Q10 BY SPEAKER BY SESSION

会做我想做的事,但事实并非如此。关于如何获得理想结果的任何想法?

ETA :对于任何可能有帮助的人,这是我使用的实际语法,更改了一些细节以删除我们客户的识别信息。

set printback=no.
set width = 80 / highres = off.
TITLE 'Speaker Evaluations'.

INPUT PROGRAM.
FILE HANDLE IN  /NAME='C:\Documents and Settings\gworley\Desktop\Surveys\hrfse\hrfse.sdf' .
DATA LIST FILE=IN FIXED RECORDS=1 /1 BATCH 1-3.
REPEATING DATA STARTS=4 / OCCURS=5
  /DATA= SPEAKER 1 (A) Q1 TO Q10 2-11.
END INPUT PROGRAM.

VARIABLE LABLES
 SPEAKER "Speaker" /
 Q1 "Speaker's knowledge of the subject" /
 Q2 "Speaker's effectiveness in communicating information"/
 Q3 'The usefulness of the information presented'/
 Q4 "Speaker's response to audience questions"/
 Q5 'The pace of this course or panel'/
 Q6 'Clarity and organization'/
 Q7 'Focus on up-to-date issues'/
 Q8 'Overall session rating'/
 Q9 "Would you recommend this speaker for next year's conference"/
 Q10 'Did this speaker try to sell their services'/.


Missing values Q1 to Q8 (4 thru high)/
           Q9 to Q10 (2 thru high).

VALUE LABELS
 SPEAKER 'A' 'Speaker 1' 'B' 'Speaker 2' 'C' 'Speaker 3' 'D' 'Speaker 4' 'E' 'Speaker 5' /
 Q1 to Q8 0 'Poor' 1 'Fair' 2 'Good' 3 'Excellent' /
 Q9 to Q10 0 'No' 1 'Yes'.

FREQUENCIES VARIABLES=Q1 to Q10 / STATISTICS=ALL.
CROSSTABS 
  /TABLES=Q1 to Q10 BY SPEAKER BY BATCH
  /CELLS= COUNT COLUMN  .

1 个答案:

答案 0 :(得分:2)

首先,我认为你的原始数据没有很好地被SPSS读取。为了阅读它,我在每个发言者之前添加了会话n°。

我尝试了以下语法文件:

// "3wayCrosstab.txt" = 001A0213210231001B2102320232001C2132021203001D1122330010001E0232120121
FILE HANDLE W3
   /NAME="3wayCrosstab.txt"
   /MODE=IMAGE
   /LRECL=14.

DATA LIST FILE=W3 
   /SESSION 1-3 (A) SPEAKER 4 (A) Q1 5 Q2 6 Q3 7 Q4 8 Q5 9 Q6 10 Q7 11 Q8 12 Q9 13 Q10 14

VALUE LABELS Q1 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q2 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q3 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q4 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q5 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q6 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q7 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q8 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q9 0 "R1" 1 "R2" 2 "R3" 3 "R4"
VALUE LABELS Q10 0 "R1" 1 "R2" 2 "R3" 3 "R4"

VALUE LABELS /SPEAKER "A" "Speaker1" "B" "Speaker2" "C" "Speaker3" "D" "Speaker4" "E" "Speaker5"

CROSSTABS /TABLE=Q1 TO Q10 BY SPEAKER BY SESSION.

我明白了:

    2.2(2) CROSSTABS.  Q1 by SPEAKER by SESSION [count].
    #=======================#============================================#========#
    #    SESSION            #                   SPEAKER                  |        #
    #                       #--------+--------+--------+--------+--------+        #
    #                     Q1#Speaker1|Speaker2|Speaker3|Speaker4|Speaker5|  Total #
    #-----------------------#--------+--------+--------+--------+--------+--------#
    #        001 R1         #     1.0|      .0|      .0|      .0|     1.0|     2.0#
    #            R2         #      .0|      .0|      .0|     1.0|      .0|     1.0#
    #            R3         #      .0|     1.0|     1.0|      .0|      .0|     2.0#
    #            Total      #     1.0|     1.0|     1.0|     1.0|     1.0|     5.0#
    #=======================#========#========#========#========#========#========#

    2.3 CROSSTABS.  Q2 by SPEAKER by SESSION [count].
    #=======================#============================================#========#
    #    SESSION            #                   SPEAKER                  |        #
    #                       #--------+--------+--------+--------+--------+        #
    #                     Q2#Speaker1|Speaker2|Speaker3|Speaker4|Speaker5|  Total #
    #-----------------------#--------+--------+--------+--------+--------+--------#
    #        001 R2         #      .0|     1.0|     1.0|     1.0|      .0|     3.0#
    #            R3         #     1.0|      .0|      .0|      .0|     1.0|     2.0#
    #            Total      #     1.0|     1.0|     1.0|     1.0|     1.0|     5.0#
    #=======================#========#========#========#========#========#========#
...