Syntax for CTABLES

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax for CTABLES

David B. Nolle
Dear List Members,
 
I am reposting this item because I have not had any responses to my previous posting. I need some help in revising my pasted syntax (see below) for CTABLES. 
 
I am trying to get several statistics normally produced by CTABLES to appear in a single table. I have two variables: Typol#7 which is a row variable and Barak_therm which is a column variable having six values. I want the following statistics to be reported in my table: column percentages in each column, the sum of the column percentages (100%) in each column, the weighted total count in each column, and the mean of typol#7 in each column. I should note that typol#7 has only three values which are -1, 0, +1.  Using the syntax noted below, I do indeed get the correct column sum, the correct weighted count, and the correct mean for typol#7 in each column. Nevertheless, I am discovering that my syntax (see below) is failing to provide the column percentages for each response option in typol#7.  I think that the reason for my failure is that I have declared typol#7 as a scale variable in order to get the mean of typol#7 for each column of the categorical variable called Barak_therm. Although I suspect that there is a way to get all of my desired statistics in a single table, I am unaware of the necessary trick. Thus, I welcome your help on this matter.   
 

CTABLES

/VLABELS VARIABLES=typol#7 Barak_therm DISPLAY=DEFAULT

/TABLE typol#7 [S][COLPCT.SUM PCT40.1, COUNT F40.0, MEAN F40.3] BY Barak_therm [C]

/SLABELS POSITION=ROW

/CATEGORIES VARIABLES=Barak_therm ORDER=A KEY=VALUE EMPTY=INCLUDE.

Thank you for your help.

David

Reply | Threaded
Open this post in threaded view
|

Re: Syntax for CTABLES

Jon K Peck

I have a hard time picturing the table you want.  I expect that others have the same problem.  If the following tip doesn't lead you to a solution, I suggest that you post a small mockup of what you want.

Tip: you can include the same variable in a table with different measurement levels.  Using the dialog, drag the variable to the canvas; then right click, change the measurement level, and drag again.

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: "David B. Nolle" <[hidden email]>
To: [hidden email]
Date: 06/27/2010 07:06 PM
Subject: [SPSSX-L] Syntax for CTABLES
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Dear List Members,
 
I am reposting this item because I have not had any responses to my previous posting. I need some help in revising my pasted syntax (see below) for CTABLES.  
 
I am trying to get several statistics normally produced by CTABLES to appear in a single table. I have two variables: Typol#7 which is a row variable and Barak_therm which is a column variable having six values. I want the following statistics to be reported in my table: column percentages in each column, the sum of the column percentages (100%) in each column, the weighted total count in each column, and the mean of typol#7 in each column. I should note that typol#7 has only three values which are -1, 0, +1.  Using the syntax noted below, I do indeed get the correct column sum, the correct weighted count, and the correct mean for typol#7 in each column. Nevertheless, I am discovering that my syntax (see below) is failing to provide the column percentages for each response option in typol#7.  I think that the reason for my failure is that I have declared typol#7 as a scale variable in order to get the mean of typol#7 for each column of the categorical variable called Barak_therm. Although I suspect that there is a way to get all of my desired statistics in a single table, I am unaware of the necessary trick. Thus, I welcome your help on this matter.  
 

CTABLES

/VLABELS VARIABLES=typol#7 Barak_therm DISPLAY=DEFAULT

/TABLE typol#7 [S][COLPCT.SUM PCT40.1, COUNT F40.0, MEAN F40.3] BY Barak_therm [C]

/SLABELS POSITION=ROW

/CATEGORIES VARIABLES=Barak_therm ORDER=A KEY=VALUE EMPTY=INCLUDE.

Thank you for your help.

David

Reply | Threaded
Open this post in threaded view
|

Re: Syntax for CTABLES

David B. Nolle
Hi Jon,
 
Using two fake variables, I have created a small mockup of the type of table that I desire. Note that the table resembles a regular crosstab but there is a mean at the bottom of each column.
 

Categorical Variable A

Variable

B

Low

Medium

High

Total

-1

25.0%

25.0%

25.0%

25.0%

0

50.0%

25.0%

0.00%

14.3%

+1

25.0%

50.0%

75.0%

60.7%

Column Total %

100.0%

100.0%

100.0%

100.0%

Weighted N

50

100

200

350

Mean on B

0.000

0.250

0.500

0.357

 
I should note that invoking multiple definitions (scale and nominal) for the row variable (B) does not seem to do the trick.
 
Thanks,
 
David 
 
----- Original Message -----
Sent: Sunday, June 27, 2010 10:31 PM
Subject: Re: [SPSSX-L] Syntax for CTABLES


I have a hard time picturing the table you want.  I expect that others have the same problem.  If the following tip doesn't lead you to a solution, I suggest that you post a small mockup of what you want.

Tip: you can include the same variable in a table with different measurement levels.  Using the dialog, drag the variable to the canvas; then right click, change the measurement level, and drag again.

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: "David B. Nolle" <[hidden email]>
To: [hidden email]
Date: 06/27/2010 07:06 PM
Subject: [SPSSX-L] Syntax for CTABLES
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Dear List Members,
 
I am reposting this item because I have not had any responses to my previous posting. I need some help in revising my pasted syntax (see below) for CTABLES.  
 
I am trying to get several statistics normally produced by CTABLES to appear in a single table. I have two variables: Typol#7 which is a row variable and Barak_therm which is a column variable having six values. I want the following statistics to be reported in my table: column percentages in each column, the sum of the column percentages (100%) in each column, the weighted total count in each column, and the mean of typol#7 in each column. I should note that typol#7 has only three values which are -1, 0, +1.  Using the syntax noted below, I do indeed get the correct column sum, the correct weighted count, and the correct mean for typol#7 in each column. Nevertheless, I am discovering that my syntax (see below) is failing to provide the column percentages for each response option in typol#7.  I think that the reason for my failure is that I have declared typol#7 as a scale variable in order to get the mean of typol#7 for each column of the categorical variable called Barak_therm. Although I suspect that there is a way to get all of my desired statistics in a single table, I am unaware of the necessary trick. Thus, I welcome your help on this matter.  
 

CTABLES

/VLABELS VARIABLES=typol#7 Barak_therm DISPLAY=DEFAULT

/TABLE typol#7 [S][COLPCT.SUM PCT40.1, COUNT F40.0, MEAN F40.3] BY Barak_therm [C]

/SLABELS POSITION=ROW

/CATEGORIES VARIABLES=Barak_therm ORDER=A KEY=VALUE EMPTY=INCLUDE.

Thank you for your help.

David

Reply | Threaded
Open this post in threaded view
|

Re: Syntax for CTABLES

Maguin, Eugene
In reply to this post by Jon K Peck
Jon,
 
That's really a clever idea. Can that be done in syntax?  How? I'm frightened to ask if this is documented but is it?
 
Gene Maguin
 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: Sunday, June 27, 2010 10:31 PM
To: [hidden email]
Subject: Re: Syntax for CTABLES


I have a hard time picturing the table you want.  I expect that others have the same problem.  If the following tip doesn't lead you to a solution, I suggest that you post a small mockup of what you want.

Tip: you can include the same variable in a table with different measurement levels.  Using the dialog, drag the variable to the canvas; then right click, change the measurement level, and drag again.

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: "David B. Nolle" <[hidden email]>
To: [hidden email]
Date: 06/27/2010 07:06 PM
Subject: [SPSSX-L] Syntax for CTABLES
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Dear List Members,
 
I am reposting this item because I have not had any responses to my previous posting. I need some help in revising my pasted syntax (see below) for CTABLES.  
 
I am trying to get several statistics normally produced by CTABLES to appear in a single table. I have two variables: Typol#7 which is a row variable and Barak_therm which is a column variable having six values. I want the following statistics to be reported in my table: column percentages in each column, the sum of the column percentages (100%) in each column, the weighted total count in each column, and the mean of typol#7 in each column. I should note that typol#7 has only three values which are -1, 0, +1.  Using the syntax noted below, I do indeed get the correct column sum, the correct weighted count, and the correct mean for typol#7 in each column. Nevertheless, I am discovering that my syntax (see below) is failing to provide the column percentages for each response option in typol#7.  I think that the reason for my failure is that I have declared typol#7 as a scale variable in order to get the mean of typol#7 for each column of the categorical variable called Barak_therm. Although I suspect that there is a way to get all of my desired statistics in a single table, I am unaware of the necessary trick. Thus, I welcome your help on this matter.  
 

CTABLES

/VLABELS VARIABLES=typol#7 Barak_therm DISPLAY=DEFAULT

/TABLE typol#7 [S][COLPCT.SUM PCT40.1, COUNT F40.0, MEAN F40.3] BY Barak_therm [C]

/SLABELS POSITION=ROW

/CATEGORIES VARIABLES=Barak_therm ORDER=A KEY=VALUE EMPTY=INCLUDE.

Thank you for your help.

David

Reply | Threaded
Open this post in threaded view
|

Re: Syntax for CTABLES

Jon K Peck

See below
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Gene Maguin <[hidden email]>
To: [hidden email]
Date: 06/28/2010 08:05 AM
Subject: Re: [SPSSX-L] Syntax for CTABLES
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Jon,
 
That's really a clever idea. Can that be done in syntax?  How? I'm frightened to ask if this is documented but is it?
>>>Yes, it is done in syntax.  the [S] and [C] modifiers in the table expression dictate the measurement level and, hence, the interpretation of the table request.  I don't know whether this is explicitly stated in the CTABLES documentation, but it is implied by the syntax.

Here's what I sent offline for this problem (using employee data.sav).  I'm not 100% sure that this is the table the poster requested, but it illustrates the multi-measurement level approach.

CTABLES
  /VLABELS VARIABLES=minority jobcat DISPLAY=DEFAULT
  /TABLE minority [C][COLPCT.COUNT PCT40.1] + minority [S][COUNT F40.0, MEAN F40.2] BY jobcat [C]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=minority jobcat ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=AFTER
    MISSING=EXCLUDE.
 
Gene Maguin
 


From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Jon K Peck
Sent:
Sunday, June 27, 2010 10:31 PM
To:
[hidden email]
Subject:
Re: Syntax for CTABLES



I have a hard time picturing the table you want.  I expect that others have the same problem.  If the following tip doesn't lead you to a solution, I suggest that you post a small mockup of what you want.


Tip: you can include the same variable in a table with different measurement levels.  Using the dialog, drag the variable to the canvas; then right click, change the measurement level, and drag again.


HTH,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435


From: "David B. Nolle" <[hidden email]>
To: [hidden email]
Date: 06/27/2010 07:06 PM
Subject: [SPSSX-L] Syntax for CTABLES
Sent by: "SPSSX(r) Discussion" <[hidden email]>






Dear List Members,

 
I am reposting this item because I have not had any responses to my previous posting. I need some help in revising my pasted syntax (see below) for CTABLES.  

 
I am trying to get several statistics normally produced by CTABLES to appear in a single table. I have two variables: Typol#7 which is a row variable and Barak_therm which is a column variable having six values. I want the following statistics to be reported in my table: column percentages in each column, the sum of the column percentages (100%) in each column, the weighted total count in each column, and the mean of typol#7 in each column. I should note that typol#7 has only three values which are -1, 0, +1.  Using the syntax noted below, I do indeed get the correct column sum, the correct weighted count, and the correct mean for typol#7 in each column. Nevertheless, I am discovering that my syntax (see below) is failing to provide the column percentages for each response option in typol#7.  I think that the reason for my failure is that I have declared typol#7 as a scale variable in order to get the mean of typol#7 for each column of the categorical variable called Barak_therm. Although I suspect that there is a way to get all of my desired statistics in a single table, I am unaware of the necessary trick. Thus, I welcome your help on this matter.  

 

CTABLES

/VLABELS VARIABLES=typol#7 Barak_therm DISPLAY=DEFAULT

/TABLE typol#7 [S][COLPCT.SUM PCT40.1, COUNT F40.0, MEAN F40.3] BY Barak_therm [C]

/SLABELS POSITION=ROW

/CATEGORIES VARIABLES=Barak_therm ORDER=A KEY=VALUE EMPTY=INCLUDE.

Thank you for your help.

David

Reply | Threaded
Open this post in threaded view
|

Re: Syntax for CTABLES

David B. Nolle
In reply to this post by David B. Nolle
Hi Jon,
 
Yes! Thank you! Your syntax did exactly what I needed.
 
David 
----- Original Message -----
Sent: Monday, June 28, 2010 9:09 AM
Subject: Re: [SPSSX-L] Syntax for CTABLES


Here is an example using the employee data.sav data shipped with Statistics.  I generated the syntax from the dialog box.  Does this do what you want?

CTABLES
  /VLABELS VARIABLES=minority jobcat DISPLAY=DEFAULT
  /TABLE minority [C][COLPCT.COUNT PCT40.1] + minority [S][COUNT F40.0, MEAN F40.2] BY jobcat [C]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=minority jobcat ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=AFTER
    MISSING=EXCLUDE.

The layout may be messed up in the email.

                                Employment Category
                                                            Clerical        CustodialManagerTotal
Minority Classification        No        Column N %        76.0%        51.9%        95.2%        78.1%
                                Yes        Column N %        24.0%        48.1%        4.8%        21.9%
                                Total        Column N %        100.0%        100.0%        100.0%        100.0%
Minority Classification        Count                            363        27        84        474
                                Mean                            .24        .48        .05        .22


Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: "David B. Nolle" <[hidden email]>
To: Jon K Peck/Chicago/IBM@IBMUS
Cc: <[hidden email]>
Date: 06/28/2010 05:09 AM
Subject: Re: [SPSSX-L] Syntax for CTABLES





Hi Jon,
 
Using two fake variables, I have created a small mockup of the type of table that I desire. Note that the table resembles a regular crosstab but there is a mean at the bottom of each column.
 
Categorical Variable A
Variable
B
Low
Medium
High
Total
-1
25.0%
25.0%
25.0%
25.0%
0
50.0%
25.0%
0.00%
14.3%
+1
25.0%
50.0%
75.0%
60.7%
Column Total %
100.0%
100.0%
100.0%
100.0%
Weighted N
50
100
200
350
Mean on B
0.000
0.250
0.500
0.357


I should note that invoking multiple definitions (scale and nominal) for the row variable (B) does not seem to do the trick.
 
Thanks,
 
David  
 
----- Original Message -----
From: [hidden email]
To: [hidden email]
Cc: [hidden email]
Sent: Sunday, June 27, 2010 10:31 PM
Subject: Re: [SPSSX-L] Syntax for CTABLES


I have a hard time picturing the table you want.  I expect that others have the same problem.  If the following tip doesn't lead you to a solution, I suggest that you post a small mockup of what you want.


Tip: you can include the same variable in a table with different measurement levels.  Using the dialog, drag the variable to the canvas; then right click, change the measurement level, and drag again.


HTH,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435


From: "David B. Nolle" <[hidden email]>
To: [hidden email]
Date: 06/27/2010 07:06 PM
Subject: [SPSSX-L] Syntax for CTABLES
Sent by: "SPSSX(r) Discussion" <[hidden email]>






Dear List Members,

 
I am reposting this item because I have not had any responses to my previous posting. I need some help in revising my pasted syntax (see below) for CTABLES.  

 
I am trying to get several statistics normally produced by CTABLES to appear in a single table. I have two variables: Typol#7 which is a row variable and Barak_therm which is a column variable having six values. I want the following statistics to be reported in my table: column percentages in each column, the sum of the column percentages (100%) in each column, the weighted total count in each column, and the mean of typol#7 in each column. I should note that typol#7 has only three values which are -1, 0, +1.  Using the syntax noted below, I do indeed get the correct column sum, the correct weighted count, and the correct mean for typol#7 in each column. Nevertheless, I am discovering that my syntax (see below) is failing to provide the column percentages for each response option in typol#7.  I think that the reason for my failure is that I have declared typol#7 as a scale variable in order to get the mean of typol#7 for each column of the categorical variable called Barak_therm. Although I suspect that there is a way to get all of my desired statistics in a single table, I am unaware of the necessary trick. Thus, I welcome your help on this matter.  

 

CTABLES

/VLABELS VARIABLES=typol#7 Barak_therm DISPLAY=DEFAULT

/TABLE typol#7 [S][COLPCT.SUM PCT40.1, COUNT F40.0, MEAN F40.3] BY Barak_therm [C]

/SLABELS POSITION=ROW

/CATEGORIES VARIABLES=Barak_therm ORDER=A KEY=VALUE EMPTY=INCLUDE.

Thank you for your help.

David