ctables question

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

ctables question

J P-6
Dear list,
 
I would liketo create a ctables omits a user-defined missing (a NA category) from the denominator for row percentages, but report the raw number of NA's at the end of the row.
 
I am looking for something like this abbreviated example:
 
                                   Satisfied                           Dissatisfied                Total                      NA  
                            Count   Row %                 Count   Row %             Count   Row %     Count
Pricing                     7         70                           3         30                     10     100            3
 
While I'm at it, is there a way to print the row % under the count, instead of beside it?
 
 
Thank you,
 
John

Reply | Threaded
Open this post in threaded view
|

Re: Ctables question

Jon K Peck

Here is an example using the cars.sav file shipped with SPSS.  Explanation below.

temporary.
if missing(origin) omissing = 1.
value labels omissing 1 'Missing'.
variable label omissing ' '.
CTABLES
  /TABLE year BY origin [COUNT ROWPCT.COUNT] + omissing [C][COUNT]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=year origin ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE
  /CATEGORIES VARIABLES=omissing [1] .

omissing is a temporary variable that will be 1 if the column variable, origin, is missing.
It has a blank variable label in order to suppress the variable name in the output.
SLABELS moves the statistics to the rows.
By concatenating omissing in the columns, you get an extra subtable that tabulates the missing values while they are excluded from the main body of the table.  Doing it this way allows the use of COUNT for both variables, so no extra labeling row is required for the statistics.

A number of variations are possible, but this should give you the idea.

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



From: J P <[hidden email]>
To: [hidden email]
Date: 01/05/2010 10:58 AM
Subject: [SPSSX-L] ctables question
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Dear list,
 
I would liketo create a ctables omits a user-defined missing (a NA category) from the denominator for row percentages, but report the raw number of NA's at the end of the row.
 
I am looking for something like this abbreviated example:
 
                                   Satisfied                           Dissatisfied                Total                      NA  
                            Count   Row %                 Count   Row %             Count   Row %     Count
Pricing                     7         70                           3         30                     10     100            3
 
While I'm at it, is there a way to print the row % under the count, instead of beside it?
 
 
Thank you,
 
John