SPSS 中的 3 路交叉表

发布于 2024-08-04 07:33:21 字数 2365 浏览 6 评论 0原文

我在 SPSS 中有一些数据,我想以特定方式格式化,但我似乎无法在文档中找到实现此目的的方法。

我的数据由 10 个问题回答(Q1 到 Q10)组成,其中 Q1 到 Q10 对应变量 SESSION 中变量 SPEAKER 的每个值。例如,每个会话最多可以有五个发言者,对于会话 1,我可能在 Q1 到 Q10 中拥有发言者 1 和 2 的数据,但没有其他发言者的数据。原始数据看起来像这样:

001A0123012301B0123012301C         D         E         

这是对话者 A 到 E 的会话 001,其中 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

执行我想要的操作,但事实并非如此。关于如何获得想要的结果有什么想法吗?

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

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  .

I have some data in SPSS that I would like to format in a particular way, but I can't seem to find a way to do it in the documentation.

I have data that consists of 10 question responses, Q1 to Q10, with a Q1 to Q10 for each value of a variable SPEAKER within a variable SESSION. For example, each session can have up to five speakers, for for session 1 I might have data in Q1 to Q10 for speaker 1 and 2, but nothing for the others. The raw data looks something like this:

001A0123012301B0123012301C         D         E         

So that's session 001 with speakers A through E where A and B have data (Q1 to Q10, one column each) and the rest don't. Notice that only four responses are possible on Q1 to Q10, and below I'll label these R1, R2, R3, and R4. Hopefully that's more detail than you're going to need.

I want to generate one table per session that looks something like this:

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      ...

The documentation seems to suggest that

CROSSTABS Q1 TO Q10 BY SPEAKER BY SESSION

will do what I want, but it doesn't. Any ideas on how I can get the desired result?

ETA: For anyone it might help, here is the actual syntax I used, with a few details changed to remove identifying information of our client.

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  .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵性 2024-08-11 07:33:21

首先,我认为您的原始数据结构不适合 SPSS 读取。为了阅读它,我在每个发言者之前添加了会话编号。

我尝试了以下语法文件:

// "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#
    #=======================#========#========#========#========#========#========#
...

first I think your raw data is not well strutured to be read by SPSS. To read it I added session n° before each speaker.

I Tried the following syntax file:

// "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.

I got this:

    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#
    #=======================#========#========#========#========#========#========#
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文