Subscribe Bookmark RSS Feed

table summary in jsl

yaviav

Community Trekker

Joined:

Feb 19, 2013

what is the code for table summary ? I found the following code:

Summarize(

a = by( ENTITY ),

maxHt = Max( ATTRIBUTE_VALUE )

);

new window( "SH Counter",

Table Box(

String Col Box( "ENTITY", a ),

Number Col Box( "SH Counter", maxHt ),

));


1. can I get the the new summary in data table and not in "new window" ?

2. if I need to have more "by groups" filter how do I add it to the code ?

5 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

1. The summarize command stores its output in the variables that you supply.  To get a data table you can either use the SUMMARY or TABULATE commands.  The nice thing about summary and tabulate is that you can create exactly the sort of summary table that you need, and then just click the little red triangle and copy the resulting script.  For example:

dt = Open( "$sample_data\Auto Raw Data.jmp" );

dt << Summary( Group( :AgeClass, :Gender, :Rating Class ));



2. To add more by groups just add them like so:

dt = Open( "$sample_data\Auto Raw Data.jmp" );

current data table(dt);

Summarize(a = by(:AgeClass, :Gender, :Rating Class), count_list = count());


The variables a and count_list now contain:

a

{{"Elder", "Elder", "Elder", "Elder", "Elder", "Elder", "Elder", "Elder", "Young",

"Young", "Young", "Young", "Young", "Young", "Young", "Young"}, {"F", "F", "F", "F",

"M", "M", "M", "M", "F", "F", "F", "F", "M", "M", "M", "M"}, {"A", "B", "C", "D",

"A", "B", "C", "D", "A", "B", "C", "D", "A", "B", "C", "D"}}

count_list

[2327, 3131, 1600, 353, 3469, 4509, 2392, 535, 228, 300, 122, 29, 288, 435, 228, 54]

yaviav

Community Trekker

Joined:

Feb 19, 2013

thx. but in code below there is no function (e.g. Min, Max, stdev, etc..). how do I add it ?

dt = Open( "$sample_data\Auto Raw Data.jmp" );

dt << Summary( Group( :AgeClass, :Gender, :Rating Class ));

pmroz

Super User

Joined:

Jun 23, 2011

The beauty of JMP is that you can get it to generate the code for you.  Simply run the command Tables > Summary and select the statistics, grouping variables, etc. that you want.  In the resulting table click the red triangle and select Edit.  There you will find the necessary JSL.

For example with the Auto Raw Data used previously:

dt = Open( "$sample_data\Auto Raw Data.jmp" );

dt << Summary(

    Group( :AgeClass, :Gender, :Rating Class ),

    Mean( :Premium USD ),

    Max( :Premium USD ),

    Min( :Premium USD ),

    Std Dev( :Premium USD ),

    Min( :Car Power ),

    Max( :Car Power )

)

ram

Contributor

Joined:

Jun 5, 2017

does summarize exclude excluded rows?
txnelson

Super User

Joined:

Jun 22, 2012

The best way to get the code for the Summary Platform is to run the interactive version of the platform.  Then, go to the data table that is the result of running the platform interactively, and right click on the triangle next to the word "Source" in the upper lefthand area of the data table (Called the Tables Panel).  Select "Edit" and you will see the JSL that was used to generate the Summary data table.  Just cut and paste the code into your script.

Jim