SPSS CTABLE syntax - need respondent counts

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

SPSS CTABLE syntax - need respondent counts

jagadishpchary
Hi Mario,

Thank you very much for the code.

I would like to generate the table in the same format but the base should
have the respondent counts and not responses.

Since using the below code, the data is transposed and not sure how to
compute the respondents counts.

Attached the SPSS Data and required table screen shot. I have highlighted
the correct bases for statement-1.
Data2.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Data2.sav>  
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_output1.jpg>

VARSTOCASES
/MAKE R1 FROM Q1r1 Q2r1 Q3r1
/MAKE R2 FROM Q1r2 Q2r2 Q3r2
/MAKE R3 FROM Q1r3 Q2r3 Q3r3
/INDEX=Brand.
VAL LAB Brand 1 "Brand 1" 2 "Brand 2" 3 "Brand 3".

VARSTOCASES
/MAKE R FROM R1 R2 R3
/INDEX = Statement.
VAL LAB Statement 1 "Statement -1" 2 "Statement -2" 3 "Statement -3" .
VAL LAB R 1 "Rank 1" 2 "Rank 2" 3 "Rank 3" 4 "Rank 4" 5 "Rank 5" 6 "Rank 6"
7 "Rank 7".

SET TNumbers=Labels.
CTABLES
  /VLABELS VARIABLES= Statement R Brand DISPLAY=NONE
  /TABLE Brand by Statement > R  [COUNT F40.0]
  /SLABELS VISIBLE = NO
  /CATEGORIES VARIABLES = Brand TOTAL = YES POSITION = BEFORE.



Could you also please help me on SPSS code.

Many thanks for your help in advance.

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: SPSS CTABLE syntax - need respondent counts

spss.giesel@yahoo.de
In that case you have to revert to the original data.

For statement 1 I would compute the Total with a syntax like 

MRSETS  /MCGROUP NAME=$R1_total VARIABLES=Q1r1 Q2r1 Q3r1.
CTABLES  /TABLE $R1_total [C][COUNT F40.0].

You can Produce separate tables for the totals , then.

If you desperately need the totals in the same table you can look at the OUTPUT EXPORT command where you can insert information at predefined locations in the Excel file. But this is a bit cumbersome.

Good luck,
Mario


Am Donnerstag, 30. Juli 2020, 16:41:59 MESZ hat jagadishpchary <[hidden email]> Folgendes geschrieben:


Hi Mario,

Thank you very much for the code.

I would like to generate the table in the same format but the base should
have the respondent counts and not responses.

Since using the below code, the data is transposed and not sure how to
compute the respondents counts.

Attached the SPSS Data and required table screen shot. I have highlighted
the correct bases for statement-1.
Data2.sav

VARSTOCASES
/MAKE R1 FROM Q1r1 Q2r1 Q3r1
/MAKE R2 FROM Q1r2 Q2r2 Q3r2
/MAKE R3 FROM Q1r3 Q2r3 Q3r3
/INDEX=Brand.
VAL LAB Brand 1 "Brand 1" 2 "Brand 2" 3 "Brand 3".

VARSTOCASES
/MAKE R FROM R1 R2 R3
/INDEX = Statement.
VAL LAB Statement 1 "Statement -1" 2 "Statement -2" 3 "Statement -3" .
VAL LAB R 1 "Rank 1" 2 "Rank 2" 3 "Rank 3" 4 "Rank 4" 5 "Rank 5" 6 "Rank 6"
7 "Rank 7".

SET TNumbers=Labels.
CTABLES
  /VLABELS VARIABLES= Statement R Brand DISPLAY=NONE
  /TABLE Brand by Statement > R  [COUNT F40.0]
  /SLABELS VISIBLE = NO
  /CATEGORIES VARIABLES = Brand TOTAL = YES POSITION = BEFORE.



Could you also please help me on SPSS code.

Many thanks for your help in advance.

Regards,
Jagadish



--

=====================
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
===================== 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: SPSS CTABLE syntax - need respondent counts

Jon Peck
What about the ROWPCT.RESPONSES.COUNT, COLPCT.RESPONSES.COUNT, or TABLEPCT.RESPONSES.COUNT statistics?

On Thu, Jul 30, 2020 at 9:11 AM [hidden email] <[hidden email]> wrote:
In that case you have to revert to the original data.

For statement 1 I would compute the Total with a syntax like 

MRSETS  /MCGROUP NAME=$R1_total VARIABLES=Q1r1 Q2r1 Q3r1.
CTABLES  /TABLE $R1_total [C][COUNT F40.0].

You can Produce separate tables for the totals , then.

If you desperately need the totals in the same table you can look at the OUTPUT EXPORT command where you can insert information at predefined locations in the Excel file. But this is a bit cumbersome.

Good luck,
Mario


Am Donnerstag, 30. Juli 2020, 16:41:59 MESZ hat jagadishpchary <[hidden email]> Folgendes geschrieben:


Hi Mario,

Thank you very much for the code.

I would like to generate the table in the same format but the base should
have the respondent counts and not responses.

Since using the below code, the data is transposed and not sure how to
compute the respondents counts.

Attached the SPSS Data and required table screen shot. I have highlighted
the correct bases for statement-1.
Data2.sav

VARSTOCASES
/MAKE R1 FROM Q1r1 Q2r1 Q3r1
/MAKE R2 FROM Q1r2 Q2r2 Q3r2
/MAKE R3 FROM Q1r3 Q2r3 Q3r3
/INDEX=Brand.
VAL LAB Brand 1 "Brand 1" 2 "Brand 2" 3 "Brand 3".

VARSTOCASES
/MAKE R FROM R1 R2 R3
/INDEX = Statement.
VAL LAB Statement 1 "Statement -1" 2 "Statement -2" 3 "Statement -3" .
VAL LAB R 1 "Rank 1" 2 "Rank 2" 3 "Rank 3" 4 "Rank 4" 5 "Rank 5" 6 "Rank 6"
7 "Rank 7".

SET TNumbers=Labels.
CTABLES
  /VLABELS VARIABLES= Statement R Brand DISPLAY=NONE
  /TABLE Brand by Statement > R  [COUNT F40.0]
  /SLABELS VISIBLE = NO
  /CATEGORIES VARIABLES = Brand TOTAL = YES POSITION = BEFORE.



Could you also please help me on SPSS code.

Many thanks for your help in advance.

Regards,
Jagadish



--

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


--
Jon K Peck
[hidden email]

===================== 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: SPSS CTABLE syntax - need respondent counts

PRogman
In reply to this post by jagadishpchary
In your data example there are 20 cases with 9 variables, and missing values
are between 3 and 9 (mostly 4 or 5). I assume the data is the rank response
to the statement (7 grade Likert? ie ordinal?).
If you want the complete dataset in the transformations add '/NULL = KEEP'
to the VARSTOCASES commands.
I don't understand how you calculated your base count for each rank. Please
explain.

/PR


jagadishpchary wrote

> Hi Mario,
>
> Thank you very much for the code.
>
> I would like to generate the table in the same format but the base should
> have the respondent counts and not responses.
>
> Since using the below code, the data is transposed and not sure how to
> compute the respondents counts.
>
> Attached the SPSS Data and required table screen shot. I have highlighted
> the correct bases for statement-1.
> Data2.sav
> &lt;http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Data2.sav&gt; 
> &lt;http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_output1.jpg&gt; 
>
> VARSTOCASES
> /MAKE R1 FROM Q1r1 Q2r1 Q3r1
> /MAKE R2 FROM Q1r2 Q2r2 Q3r2
> /MAKE R3 FROM Q1r3 Q2r3 Q3r3
> /INDEX=Brand.
> VAL LAB Brand 1 "Brand 1" 2 "Brand 2" 3 "Brand 3".
>
> VARSTOCASES
> /MAKE R FROM R1 R2 R3
> /INDEX = Statement.
> VAL LAB Statement 1 "Statement -1" 2 "Statement -2" 3 "Statement -3" .
> VAL LAB R 1 "Rank 1" 2 "Rank 2" 3 "Rank 3" 4 "Rank 4" 5 "Rank 5" 6 "Rank
> 6"
> 7 "Rank 7".
>
> SET TNumbers=Labels.
> CTABLES
>   /VLABELS VARIABLES= Statement R Brand DISPLAY=NONE
>   /TABLE Brand by Statement > R  [COUNT F40.0]
>   /SLABELS VISIBLE = NO
>   /CATEGORIES VARIABLES = Brand TOTAL = YES POSITION = BEFORE.
>
>
>
> Could you also please help me on SPSS code.
>
> Many thanks for your help in advance.
>
> 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