Sorting by top 2 box for likert scales in CTABLES

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

Sorting by top 2 box for likert scales in CTABLES

Jignesh Sutar
CTABLES allows tables whose variables all have the same labels to have the categories presented as columns (very useful). However, is it also possible to order the variables by a certain category?

For example for likert scales you may want to order by top or net top 2 box scores?

I tried adding  "order=a key=summary(&T2B)" to the /CATEGORIES sub command but without success. Is not natively with CTABLES then how can this be achieved using posthoc output modify extensions?

**************************************.
*Making Fake Data.
set seed = 10.
input program.
loop #i = 1 to 500.
compute case = #i.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.
*making 30 likert scale variables.
vector Likert(9, F1.0).
do repeat Likert = Likert1 to Likert9.
compute Likert = TRUNC(RV.UNIFORM(1,6)).
end repeat.
compute Brand=mod($casenum,2).
execute.
value labels Likert1 to Likert9
1 'SD'
2 'D'
3 'N'
4 'A'
5 'SA'.
**************************************.

ctables
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no
  /vlabels variables=all display=label
    /table (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct, total[count]]
      /clabels rowlabels=opposite
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes
      /titles title="Likert scales".



Reply | Threaded
Open this post in threaded view
|

Re: Sorting by top 2 box for likert scales in CTABLES

Jon K Peck
One simple thing you can do is to activate the table, select a column, right click, and choose Sort Rows.

You can also use SPSSINC MODIFY TABLES with the customstylefunctions.sortTable function included with that command to automate this.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Jignesh Sutar <[hidden email]>
To:        [hidden email]
Date:        12/04/2014 04:33 AM
Subject:        [SPSSX-L] Sorting by top 2 box for likert scales in CTABLES
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




CTABLES allows tables whose variables all have the same labels to have the
categories presented as columns (very useful). However, is it also possible
to order the variables by a certain category?

For example for likert scales you may want to order by top or net top 2 box
scores?

I tried adding  "order=a key=summary(&T2B)" to the /CATEGORIES sub command
but without success. Is not natively with CTABLES then how can this be
achieved using posthoc output modify extensions?

**************************************.
*Making Fake Data.
set seed = 10.
input program.
loop #i = 1 to 500.
compute case = #i.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.
*making 30 likert scale variables.
vector Likert(9, F1.0).
do repeat Likert = Likert1 to Likert9.
compute Likert = TRUNC(RV.UNIFORM(1,6)).
end repeat.
compute Brand=mod($casenum,2).
execute.
value labels Likert1 to Likert9
1 'SD'
2 'D'
3 'N'
4 'A'
5 'SA'.
**************************************.

ctables
 /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box"
hidesourcecats=no
 /vlabels variables=all display=label
   /table
(Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct,
total[count]]
     /clabels rowlabels=opposite
     /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6
Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes
     /titles title="Likert scales".



<
http://spssx-discussion.1045642.n5.nabble.com/file/n5728107/Capture.png>



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Sorting-by-top-2-box-for-likert-scales-in-CTABLES-tp5728107.html
Sent from the SPSSX Discussion mailing list archive at 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
Reply | Threaded
Open this post in threaded view
|

Re: Sorting by top 2 box for likert scales in CTABLES

Jignesh Sutar
Brilliant, thanks Jon.

I have this working to be able to sort rows but can it also sort columns from left to right? If not, is there a transpose function I could possibly use? Is there a transpose function anyway? Could be useful for Statistics tables from FREQUENCIES command.

ctables 
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no
  /vlabels variables=all display=label
    /table (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct, total[count]]
      /clabels rowlabels=opposite
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes 
      /titles title="Likert scales".


SPSSINC MODIFY TABLES subtype='Custom Table'
SELECT="% Top 2 box" DIMENSION= COLUMNS level=-2
/STYLES APPLYTO=DATACELLS 
CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')".





ctables 
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no format=colpct pct8.1
  /vlabels variables=all display=label
    /table by (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][colpct, total[count]]
      /clabels collabels=opposite /slabels position=row visible=no
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes 
      /titles title="Likert scales".

SPSSINC MODIFY TABLES subtype='Custom Table'
SELECT="% Top 2 box" DIMENSION= rows level=-1
/STYLES APPLYTO=DATACELLS 
CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')".


On 4 December 2014 at 13:50, Jon K Peck <[hidden email]> wrote:
One simple thing you can do is to activate the table, select a column, right click, and choose Sort Rows.

You can also use SPSSINC MODIFY TABLES with the customstylefunctions.sortTable function included with that command to automate this.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Jignesh Sutar <[hidden email]>
To:        [hidden email]
Date:        12/04/2014 04:33 AM
Subject:        [SPSSX-L] Sorting by top 2 box for likert scales in CTABLES
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




CTABLES allows tables whose variables all have the same labels to have the
categories presented as columns (very useful). However, is it also possible
to order the variables by a certain category?

For example for likert scales you may want to order by top or net top 2 box
scores?

I tried adding  "order=a key=summary(&T2B)" to the /CATEGORIES sub command
but without success. Is not natively with CTABLES then how can this be
achieved using posthoc output modify extensions?

**************************************.
*Making Fake Data.
set seed = 10.
input program.
loop #i = 1 to 500.
compute case = #i.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.
*making 30 likert scale variables.
vector Likert(9, F1.0).
do repeat Likert = Likert1 to Likert9.
compute Likert = TRUNC(RV.UNIFORM(1,6)).
end repeat.
compute Brand=mod($casenum,2).
execute.
value labels Likert1 to Likert9
1 'SD'
2 'D'
3 'N'
4 'A'
5 'SA'.
**************************************.

ctables
 /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box"
hidesourcecats=no
 /vlabels variables=all display=label
   /table
(Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct,
total[count]]
     /clabels rowlabels=opposite
     /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6
Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes
     /titles title="Likert scales".



<
http://spssx-discussion.1045642.n5.nabble.com/file/n5728107/Capture.png>



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Sorting-by-top-2-box-for-likert-scales-in-CTABLES-tp5728107.html
Sent from the SPSSX Discussion mailing list archive at 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

===================== 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: Sorting by top 2 box for likert scales in CTABLES

Jignesh Sutar
Found the transpose function (and many more), is the sort function only to sort rows then or can it sort columns left to right also?

SPSSINC MODIFY TABLES subtype='Custom Table' SELECT=0 DIMENSION= ROWS
 /STYLES  APPLYTO=LABELS CUSTOMFUNCTION="customstylefunctions.transpose".


On 4 December 2014 at 16:15, Jignesh Sutar <[hidden email]> wrote:
Brilliant, thanks Jon.

I have this working to be able to sort rows but can it also sort columns from left to right? If not, is there a transpose function I could possibly use? Is there a transpose function anyway? Could be useful for Statistics tables from FREQUENCIES command.

ctables 
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no
  /vlabels variables=all display=label
    /table (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct, total[count]]
      /clabels rowlabels=opposite
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes 
      /titles title="Likert scales".


SPSSINC MODIFY TABLES subtype='Custom Table'
SELECT="% Top 2 box" DIMENSION= COLUMNS level=-2
/STYLES APPLYTO=DATACELLS 
CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')".





ctables 
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no format=colpct pct8.1
  /vlabels variables=all display=label
    /table by (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][colpct, total[count]]
      /clabels collabels=opposite /slabels position=row visible=no
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes 
      /titles title="Likert scales".

SPSSINC MODIFY TABLES subtype='Custom Table'
SELECT="% Top 2 box" DIMENSION= rows level=-1
/STYLES APPLYTO=DATACELLS 
CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')".


On 4 December 2014 at 13:50, Jon K Peck <[hidden email]> wrote:
One simple thing you can do is to activate the table, select a column, right click, and choose Sort Rows.

You can also use SPSSINC MODIFY TABLES with the customstylefunctions.sortTable function included with that command to automate this.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Jignesh Sutar <[hidden email]>
To:        [hidden email]
Date:        12/04/2014 04:33 AM
Subject:        [SPSSX-L] Sorting by top 2 box for likert scales in CTABLES
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




CTABLES allows tables whose variables all have the same labels to have the
categories presented as columns (very useful). However, is it also possible
to order the variables by a certain category?

For example for likert scales you may want to order by top or net top 2 box
scores?

I tried adding  "order=a key=summary(&T2B)" to the /CATEGORIES sub command
but without success. Is not natively with CTABLES then how can this be
achieved using posthoc output modify extensions?

**************************************.
*Making Fake Data.
set seed = 10.
input program.
loop #i = 1 to 500.
compute case = #i.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.
*making 30 likert scale variables.
vector Likert(9, F1.0).
do repeat Likert = Likert1 to Likert9.
compute Likert = TRUNC(RV.UNIFORM(1,6)).
end repeat.
compute Brand=mod($casenum,2).
execute.
value labels Likert1 to Likert9
1 'SD'
2 'D'
3 'N'
4 'A'
5 'SA'.
**************************************.

ctables
 /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box"
hidesourcecats=no
 /vlabels variables=all display=label
   /table
(Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct,
total[count]]
     /clabels rowlabels=opposite
     /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6
Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes
     /titles title="Likert scales".



<
http://spssx-discussion.1045642.n5.nabble.com/file/n5728107/Capture.png>



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Sorting-by-top-2-box-for-likert-scales-in-CTABLES-tp5728107.html
Sent from the SPSSX Discussion mailing list archive at 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


===================== 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: Sorting by top 2 box for likert scales in CTABLES

Jon K Peck
In reply to this post by Jignesh Sutar
There is a transpose operation available in the p.t. editor, or you can build the initial table in its transposed form, or you can use the transpose operation in OUTPUT MODIFY or you can use the customstylefunctions.transpose function with MODIFY TABLES.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Jignesh Sutar <[hidden email]>
To:        [hidden email]
Date:        12/04/2014 09:26 AM
Subject:        Re: [SPSSX-L] Sorting by top 2 box for likert scales in CTABLES
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Brilliant, thanks Jon.

I have this working to be able to sort rows but can it also sort columns from left to right? If not, is there a transpose function I could possibly use? Is there a transpose function anyway? Could be useful for Statistics tables from FREQUENCIES command.

ctables 
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no
  /vlabels variables=all display=label
    /table (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct, total[count]]
      /clabels rowlabels=opposite
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes 
      /titles title="Likert scales".


SPSSINC MODIFY TABLES subtype='Custom Table'
SELECT="% Top 2 box" DIMENSION= COLUMNS level=-2
/STYLES APPLYTO=DATACELLS 
CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')".





ctables 
  /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box" hidesourcecats=no format=colpct pct8.1
  /vlabels variables=all display=label
    /table by (Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][colpct, total[count]]
      /clabels collabels=opposite /slabels position=row visible=no
      /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6 Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes 
      /titles title="Likert scales".

SPSSINC MODIFY TABLES subtype='Custom Table'
SELECT="% Top 2 box" DIMENSION= rows level=-1
/STYLES APPLYTO=DATACELLS 
CUSTOMFUNCTION="customstylefunctions.sortTable(direction='d')".


On 4 December 2014 at 13:50, Jon K Peck <peck@...> wrote:
One simple thing you can do is to activate the table, select a column, right click, and choose Sort Rows.

You can also use SPSSINC MODIFY TABLES with the customstylefunctions.sortTable function included with that command to automate this.



Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM

peck@...
phone: 720-342-5621





From:        
Jignesh Sutar <jsutar@...>
To:        
[hidden email]
Date:        
12/04/2014 04:33 AM
Subject:        
[SPSSX-L] Sorting by top 2 box for likert scales in CTABLES
Sent by:        
"SPSSX(r) Discussion" <[hidden email]>




CTABLES allows tables whose variables all have the same labels to have the
categories presented as columns (very useful). However, is it also possible
to order the variables by a certain category?

For example for likert scales you may want to order by top or net top 2 box
scores?

I tried adding  "order=a key=summary(&T2B)" to the /CATEGORIES sub command
but without success. Is not natively with CTABLES then how can this be
achieved using posthoc output modify extensions?

**************************************.
*Making Fake Data.
set seed = 10.
input program.
loop #i = 1 to 500.
compute case = #i.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.
*making 30 likert scale variables.
vector Likert(9, F1.0).
do repeat Likert = Likert1 to Likert9.
compute Likert = TRUNC(RV.UNIFORM(1,6)).
end repeat.
compute Brand=mod($casenum,2).
execute.
value labels Likert1 to Likert9
1 'SD'
2 'D'
3 'N'
4 'A'
5 'SA'.
**************************************.

ctables
 /pcompute &T2B = expr([4] + [5]) /pproperties &T2B label = "% Top 2 box"
hidesourcecats=no
 /vlabels variables=all display=label
   /table
(Likert1+Likert2+Likert3+Likert4+Likert5+Likert6+Likert7+Likert8+Likert9)[c][rowpct,
total[count]]
     /clabels rowlabels=opposite
     /categories variables=Likert1 Likert2 Likert3 Likert4 Likert5 Likert6
Likert7 Likert8 Likert9 [1 thru 5, &T2B] total=yes
     /titles title="Likert scales".



<
http://spssx-discussion.1045642.n5.nabble.com/file/n5728107/Capture.png>



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Sorting-by-top-2-box-for-likert-scales-in-CTABLES-tp5728107.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to

LISTSERV@... (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
LISTSERV@... (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 LISTSERV@... (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