Date: Mon, 19 Mar 2012 06:24:55 +0100
Reply-To: John F Hall <johnfhall@orange.fr>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: John F Hall <johnfhall@orange.fr>
Subject: Re: In support of CTABLES
In-Reply-To: <OF093571FE.4AFBC43E-ON872579C5.007B035B-872579C5.007C1561@us.ibm.com>
Content-Type: multipart/alternative;
Jon
Waking up at 4:15 am, it was a delight to find your mail. This is
brilliant. I've modified your syntax to suit my data set, but I need to
work out how to get the syntax from the GUI since that's what students will
use. Here are the tables (and syntax) I produced:
1: Zero order
ctables
/tables by happy [c] [ROWPCT.COUNT TOTALS[COUNT]]
/CATEGORIES VARIABLES=happy TOTAL=YES POSITION=AFTER .
Q.53 How [happy] are you these days?
Not too happy
Fairly Happy
Very happy
Total
Row N %
Row N %
Row N %
Count
6.2%
55.7%
38.1%
926
2: First order
CTABLES
/TABLE marital [C] BY happy [C][ROWPCT.COUNT TOTALS[COUNT]]
/CATEGORIES VARIABLES= marital happy TOTAL=YES POSITION=AFTER .
Q.53 How [happy] are you these days?
Not too happy
Fairly Happy
Very happy
Total
Row N %
Row N %
Row N %
Count
Marital status of respondent
Single
4.7%
70.0%
25.3%
150
Married
4.5%
51.9%
43.6%
649
Widowed
17.3%
59.2%
23.5%
98
Divorced or separated
13.8%
55.2%
31.0%
29
Total
6.2%
55.7%
38.1%
926
Q.53 How [happy] are you these days?
Not too happy
Fairly Happy
Very happy
Total
Row N %
Row N %
Row N %
Count
Sex of Respondent
Men
6.2%
59.7%
34.0%
385
Women
6.1%
52.9%
41.0%
541
Total
6.2%
55.7%
38.1%
926
The format of these tables is exactly what I want for earlier tutorials (and
for reports): it's a shame I can't get them using CROSSTABS.
3: Second order
CTABLES
/TABLE marital [C] BY happy [C][ROWPCT.COUNT TOTALS[COUNT]]
/CATEGORIES VARIABLES= marital happy TOTAL=YES POSITION=AFTER .
Q.53 How [happy] are you these days? Total
Sex of Respondent
Total
Men
Women
Count
Count
Count
Marital status of respondent
Total
926
385
541
Single
150
76
74
Married
649
288
361
Widowed
98
15
83
Divorced or separated
29
6
23
OOPS!!
45 year old Algol programming instinct made me try:
CTABLES
/TABLE marital [C] > sex [c] by happy [C][ROWPCT.COUNT TOTALS[COUNT]]
/CATEGORIES VARIABLES= marital sex happy TOTAL=YES POSITION=after .
Q.53 How [happy] are you these days?
Not too happy
Fairly Happy
Very happy
Total
Row N %
Row N %
Row N %
Count
Marital status of respondent
Single
Sex of Respondent
Men
5.3%
75.0%
19.7%
76
Women
4.1%
64.9%
31.1%
74
Total
4.7%
70.0%
25.3%
150
Married
Sex of Respondent
Men
5.2%
55.6%
39.2%
288
Women
3.9%
49.0%
47.1%
361
Total
4.5%
51.9%
43.6%
649
Widowed
Sex of Respondent
Men
26.7%
60.0%
13.3%
15
Women
15.7%
59.0%
25.3%
83
Total
17.3%
59.2%
23.5%
98
Divorced or separated
Sex of Respondent
Men
16.7%
66.7%
16.7%
6
Women
13.0%
52.2%
34.8%
23
Total
13.8%
55.2%
31.0%
29
Total
Sex of Respondent
Men
6.2%
59.7%
34.0%
385
Women
6.1%
52.9%
41.0%
541
Total
6.2%
55.7%
38.1%
926
CTABLES
/TABLE sex [c] > marital [C] by happy [C] [ROWPCT.COUNT TOTALS[COUNT]]
/CATEGORIES VARIABLES= marital sex happy TOTAL=YES POSITION=after .
Q.53 How [happy] are you these days?
Not too happy
Fairly Happy
Very happy
Total
Row N %
Row N %
Row N %
Count
Sex of Respondent
Men
Marital status of respondent
Single
5.3%
75.0%
19.7%
76
Married
5.2%
55.6%
39.2%
288
Widowed
26.7%
60.0%
13.3%
15
Divorced or separated
16.7%
66.7%
16.7%
6
Total
6.2%
59.7%
34.0%
385
Women
Marital status of respondent
Single
4.1%
64.9%
31.1%
74
Married
3.9%
49.0%
47.1%
361
Widowed
15.7%
59.0%
25.3%
83
Divorced or separated
13.0%
52.2%
34.8%
23
Total
6.1%
52.9%
41.0%
541
Total
Marital status of respondent
Single
4.7%
70.0%
25.3%
150
Married
4.5%
51.9%
43.6%
649
Widowed
17.3%
59.2%
23.5%
98
Divorced or separated
13.8%
55.2%
31.0%
29
Total
6.2%
55.7%
38.1%
926
There's rather too much data in these tables: they might be more informative
if the Total rows were dropped, leaving just the Total column as below, but
tidier:
Q.53 How [happy] are you these days?
Not too happy
Fairly Happy
Very happy
Total
Row N %
Row N %
Row N %
Count
Total
6.2%
55.7%
38.1%
926
Sex of respondent
Men
6.2%
59.7%
34.0%
385
Women
6.1%
52.9%
41.0%
541
Marital status of respondent
Single
Men
5.3%
75.0%
19.7%
76
Women
4.1%
64.9%
31.1%
74
Married
Men
5.2%
55.6%
39.2%
288
Women
3.9%
49.0%
47.1%
361
Widowed
Men
26.7%
60.0%
13.3%
15
Women
15.7%
59.0%
25.3%
83
Divorced or separated
Men
16.7%
66.7%
16.7%
6
Women
13.0%
52.2%
34.8%
23
. . . or perhaps analyse only one category at a time to generate smaller
tables.
The next step would be to take a criterion value for the dependent variable,
ie value 1 (Not too happy) or value 3 (Very happy) and produce a summary
table as in my earlier mail. In that, I used "Very happy", but being happy
is normative, so I suspect it would be more interesting to pursue the "Not
too happy" category.
I still need to check out David's syntax, but now that I've been let loose
with a new toy, preparation of and planting in the vegetable garden will be
a less attractive proposition: the next few days are going to be fun.
Cordialement
John
Email: johnfhall@orange.fr
Website: www.surveyresearch.weebly.com <http://surveyresearch.weebly.com/>
Skype: surveyresearcher1
Phone: (+33) (0) 2.33.45.91.47
From: Jon K Peck [mailto:peck@us.ibm.com]
Sent: 18 March 2012 23:35
To: John F Hall
Subject: RE: In support of CTABLES
One comment jumps out at me
"This table is easier to interpret, but we have lost the base for
percentaging at the end of each row. Without special programming beyond the
scope of this tutorial, SPSS cannot produce a table with n instead of 100%.
A more useful table would look like this:"
In the Summary Statistics subdialog (and, of course, in the TABLE
subcommand), you can choose different statistics for totals from the items
tabulated.
For example,
CTABLES
/TABLE gender [C] BY jobcat [C][ROWPCT.COUNT TOTALS[COUNT]]
/CATEGORIES VARIABLES=gender jobcat TOTAL=YES POSITION=AFTER .
gives you percents on the non-total cells and counts for the totals cells.
Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
peck@us.ibm.com
new phone: 720-342-5621
[text/html]