Need SPSS CTABLE syntax

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

Need SPSS CTABLE syntax

jagadishpchary
Dear All,

Need your help on the SPSS Ctable syntax.

I have 3 brands for which there are 3 statements each - which are having
Ranks from 1 to 7. I was trying to generate a table in the format specified
below. Also attached the SPSS data file.
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_format.jpg>
Data1.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Data1.sav>  


I tried many ways to do it but unable to get the table in the required
format. Could anyone kindly help with me on the Ctable syntax.

Attached the final required table - which I have manually entered the number
for reference. 
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_output.jpg>

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: Need SPSS CTABLE syntax

Mario Giesel-2
Hi, Jagadish,
I would restructure to long format for this.

*-------------------------------------------------------------------------------------------------.
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 Statement BY R > Brand [COUNT F40.0]
  /SLABELS VISIBLE = NO
  /CATEGORIES VARIABLES = Statement TOTAL = YES POSITION = BEFORE.
*-------------------------------------------------------------------------------------------------.

Good luck!

Mario
Munich, Germany



Am Montag, 27. Juli 2020, 14:10:35 MESZ hat jagadishpchary <[hidden email]> Folgendes geschrieben:


Dear All,

Need your help on the SPSS Ctable syntax.

I have 3 brands for which there are 3 statements each - which are having
Ranks from 1 to 7. I was trying to generate a table in the format specified
below. Also attached the SPSS data file.
Data1.sav


I tried many ways to do it but unable to get the table in the required
format. Could anyone kindly help with me on the Ctable syntax.

Attached the final required table - which I have manually entered the number
for reference. 

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: Need SPSS CTABLE syntax

jagadishpchary
This post was updated on .
Hi Mario,

Thank you very much for the code - it is working fine. However I would like
to generate the table in the below format as well. Attached the data file and table format.

<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_format.jpg
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.

Hence i have modified your code and generated the table. however the base at
the top has the responses counts and not the respondents counts. Could you also please help me on this as well.

I have highlighted the correct bases for statement-1. here attached the screen shot.

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@LISTSERV.UGA.EDU (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: Need SPSS CTABLE syntax

PRogman
In reply to this post by Mario Giesel-2
I believe the CTABLES has the wrong order of the variables.
/PR

CTABLES
  /VLABELS    VARIABLES = Statement R Brand  DISPLAY   = NONE
  /TABLE      Brand
           BY Statement  
            > R [COUNT F8.0]
  /SLABELS    VISIBLE   = NO
  /CATEGORIES VARIABLES = Statement TOTAL = YES POSITION = BEFORE.





--
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: Need SPSS CTABLE syntax

Mario Giesel-2
In reply to this post by jagadishpchary
Add "R" in

  /CATEGORIES VARIABLES = Statement R TOTAL = YES POSITION = BEFORE.



Am Montag, 27. Juli 2020, 17:43:49 MESZ hat jagadishpchary <[hidden email]> Folgendes geschrieben:


Hi Mario,

Thank you very much for the code - it is working fine. However i would like
to use the same data in the below format as well i.e.
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_format.jpg>
Data1.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Data1.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 = Statement TOTAL = YES POSITION = BEFORE.

Hence i have modified your code and generated the table. however the base at
the top of the table is not displayed. Please note that i need the
respondents base (not responses). Could you also please help me on this as
well.
<http://spssx-discussion.1045642.n5.nabble.com/file/t340698/Table_output.jpg>

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