CTABLES Syntax for Summary tables

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

CTABLES Syntax for Summary tables

jagadishpchary
Dear All,

Need your help in generating SPSS Ctable syntax for summary table.

I have a data set which has the rating scale questions with 7 being
'strongly agree' and 1 being 'strongly disagree'. I need to generate the
tables in 2 formats. Data.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Data.sav>  

1. Generate a single T2B-summary table for with all the variables (stacking)
using SPSS custom tables - which should have the individual bases for each
rating variable (since the basses are different for each variable). Example
shown in attached excel (table 1). Summary_Tables.xlsx
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Summary_Tables.xlsx>  

2. Generate a single T2B-summary table with all the variables (stacking)
using SPSS custom tables which should have single base for all rating
variables. Please note that this table is required when equal number of
respondents are answering all the rating questions. Also Note that the
percentages shown in attached excel (table 2) are not the exact calculated
values - just shown only for illustration.

Many thanks for providing the syntax.

Regards,
Jagadish



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: CTABLES Syntax for Summary tables

PRogman
Doing the background calculations manually. Previously you have been
unwilling to restructure your data, so this solution uses a temporary
dataset to do calculations and to print the tables.
HTH, PR

****************************************.
DATASET ACTIVATE JP2 WINDOW=ASIS.
DATASET COPY     JPX.
DATASET ACTIVATE JPX WINDOW=ASIS.

COMPUTE ID = $CaseNum.
VARSTOCASES
  /MAKE    Choice 'Brand Choice'
   FROM    Q1r1 Q1r2 Q1r3 Q1r4 Q1r5 Q1r6 Q1r7
  /INDEX = Brand(7)
  /KEEP  = ID
  /NULL  = KEEP
.
*may want to set brand lables.
*VALUE LABELS Brand
  1 'Brand 1'
.
AGGREGATE
  /OUTFILE          = *
   MODE             = ADDVARIABLES
  /BREAK            = Brand
  /NumCases 'Total' = MAX(ID)
  /Miss 'Missing'   = NUMISS(Choice)
  /Choice67         = CIN(Choice 6 7)
.
COMPUTE BaseTotal = NumCases - Miss.
COMPUTE T2B       = Choice67 / BaseTotal * 100.

*Table work.
CTABLES
  /VLABELS    VARIABLES = Brand BaseTotal T2B
              DISPLAY   = LABEL
  /TABLE      Brand
            > (BaseTotal [MEAN]
            + T2B        [MEAN])
  /SLABELS    VISIBLE=NO
  /CATEGORIES VARIABLES = Brand   ORDER=A KEY=VALUE EMPTY=EXCLUDE
  /TITLES     TITLE     = 'Summary Table 1'
.
CTABLES
  /VLABELS    VARIABLES = NumCases T2B
              DISPLAY   = LABEL
  /VLABELS    VARIABLES = Brand
              DISPLAY   = LABEL
  /TABLE      NumCases [S][MEAN F8.0]
            + Brand    [C]
            > T2B      [S][MEAN PCT8.0]
  /SLABELS    VISIBLE   = NO
  /CATEGORIES VARIABLES = Brand ORDER=A KEY=VALUE EMPTY=EXCLUDE
  /TITLES     TITLE     = 'Summary Table 2'
.
*back to original dataset and delete temporary dataset.
DATASET ACTIVATE JP2 WINDOW=ASIS.
DATASET CLOSE    JPX.
****************************************.

 
jagadishpchary wrote

> Dear All,
>
> Need your help in generating SPSS Ctable syntax for summary table.
>
> I have a data set which has the rating scale questions with 7 being
> 'strongly agree' and 1 being 'strongly disagree'. I need to generate the
> tables in 2 formats. Data.sav
> &lt;http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Data.sav&gt; 
>
> 1. Generate a single T2B-summary table for with all the variables
> (stacking)
> using SPSS custom tables - which should have the individual bases for each
> rating variable (since the basses are different for each variable).
> Example
> shown in attached excel (table 1). Summary_Tables.xlsx
> &lt;http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Summary_Tables.xlsx&gt; 
>
> 2. Generate a single T2B-summary table with all the variables (stacking)
> using SPSS custom tables which should have single base for all rating
> variables. Please note that this table is required when equal number of
> respondents are answering all the rating questions. Also Note that the
> percentages shown in attached excel (table 2) are not the exact calculated
> values - just shown only for illustration.
>
> Many thanks for providing the syntax.
>
> Regards,
> Jagadish
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: CTABLES Syntax for Summary tables

jagadishpchary
Many thanks for the code PRogman. However could also please share the code
with restructuring the variables.

Regards,
Jagadish



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: CTABLES Syntax for Summary tables

PRogman
It is in the syntax, see VARSTOCASES.
/PR



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD