Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Sorting Tabulate by Statistic

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 23, 2013 5:58 AM
(5181 views)

Hello,

I have I am trying to be able to create a tabular table where I can sort the values by the statistic, such as mean value. So for example, for the sample file "Car Poll", I have the following basic tabulate code:

Tabulate(

Add Table(

Column Table( Analysis Columns( :age ), Statistics( Mean ) ),

Row Table( Grouping Columns( :size ) )

)

);

Which produces the following pivot table:

Age

size Mean

Large 33.3

Medium 30.7

Small 30.0

but I would like to be able to sort the means in descending value so the first row shows "Medium " and it's values, 2nd row as "Large", and 3rd row as "Small". I know there is a

Sort(By()) function for data tables, but there doesn't seem to be anything similar for tabulate. Does anyone have a suggestion of how I could achieve this?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I can't find a direct interactive way to sort a tabulate report. However, it acknowledges the value ordering column property.

This code should work to conditionally set value ordering for a column (only tried it in JMP 10):

dt = Open**(** "$SAMPLE_DATA/Car Poll.jmp" **)**;

col_list = **{**:size, :age**}**;

Summarize**(** g = by**(** col_list**[****1****]** **)**, m = Mean**(** col_list**[****2****]** **)** **)**;

col_list**[****1****]** << Set Property**(** "Value Ordering", Eval**(** g**[**Rank Index**(** m **)]** **)** **)**;

dt << Tabulate**(**

Add Table**(**

Column Table**(** Analysis Columns**(** col_list**[****2****]** **)**, Statistics**(** Mean **)** **)**,

Row Table**(** Grouping Columns**(** col_list**[****1****]** **)** **)**

**)**

**)**;

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I can't find a direct interactive way to sort a tabulate report. However, it acknowledges the value ordering column property.

This code should work to conditionally set value ordering for a column (only tried it in JMP 10):

dt = Open**(** "$SAMPLE_DATA/Car Poll.jmp" **)**;

col_list = **{**:size, :age**}**;

Summarize**(** g = by**(** col_list**[****1****]** **)**, m = Mean**(** col_list**[****2****]** **)** **)**;

col_list**[****1****]** << Set Property**(** "Value Ordering", Eval**(** g**[**Rank Index**(** m **)]** **)** **)**;

dt << Tabulate**(**

Add Table**(**

Column Table**(** Analysis Columns**(** col_list**[****2****]** **)**, Statistics**(** Mean **)** **)**,

Row Table**(** Grouping Columns**(** col_list**[****1****]** **)** **)**

**)**

**)**;