<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Summary Data Table by Category in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/339112#M58720</link>
    <description>&lt;P&gt;Thanks Jim and Michael.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Dec 2020 13:12:06 GMT</pubDate>
    <dc:creator>Lino</dc:creator>
    <dc:date>2020-12-03T13:12:06Z</dc:date>
    <item>
      <title>Summary Data Table by Category</title>
      <link>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/338749#M58680</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data with around 5000 rows.&lt;/P&gt;&lt;P&gt;There three columns (Group, Score and Count)&lt;/P&gt;&lt;P&gt;Value for Group: A, B&lt;/P&gt;&lt;P&gt;Value for Score ranging 0.5 - 1&lt;/P&gt;&lt;P&gt;Value for Count is 1 for each row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lino_0-1606919316800.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28695i2600B3221EDC0E22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lino_0-1606919316800.png" alt="Lino_0-1606919316800.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to summary the data by group A and B and group the Score value in few category and then sum the count for each score category , as below format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lino_1-1606919681918.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28696iAE2E48950C99F562/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lino_1-1606919681918.png" alt="Lino_1-1606919681918.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am seeking help from the community how to create JSL script to perform this task?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach data here as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 21:59:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/338749#M58680</guid>
      <dc:creator>Lino</dc:creator>
      <dc:date>2023-06-09T21:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Summary Data Table by Category</title>
      <link>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/338906#M58690</link>
      <description>&lt;P&gt;I would use an interactive approach to capture a script for this. First, let's start with the data table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_0-1606922913008.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28701i4074B20BB2F65F7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_0-1606922913008.png" alt="Michael_MXAK_0-1606922913008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I left Count off because we won't need it but it won't hurt if it's there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I selected the Score column, then navigated to Cols, Utilities, Make Binning Formula:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_1-1606922971171.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28702i6B1997E5412AE134/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_1-1606922971171.png" alt="Michael_MXAK_1-1606922971171.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And set Offset to 0.5, and bin width to 0.1:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_2-1606923036446.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28703iA96391D235FE93BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_2-1606923036446.png" alt="Michael_MXAK_2-1606923036446.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Right click the new column (Score Binned) and Copy Column Properties:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_3-1606923089990.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28704i548455E42D614A19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_3-1606923089990.png" alt="Michael_MXAK_3-1606923089990.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then open a new script window and paste (ctrl-V), which results in this JSL:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Add Column Properties(
	Value Labels(
		{-0.5 = "-0.5 — -0.4", -0.4 = "-0.4 — -0.3", -0.3 = "-0.3 — -0.2", -0.2 =
		"-0.2 — -0.1", -0.1 = "-0.1 — 0", 0 = "0 — 0.1", 0.1 = "0.1 — 0.2", 0.2 =
		"0.2 — 0.3", 0.3 = "0.3 — 0.4", 0.4 = "0.4 — 0.5", 0.5 = "0.5 — 0.6", 0.6 =
		"0.6 — 0.7", 0.7 = "0.7 — 0.8", 0.8 = "0.8 — 0.9", 0.9 = "0.9 — 1", 1 =
		"1 — 1.1", 1.1 = "1.1 — 1.2", 1.2 = "1.2 — 1.3", 1.3 = "1.3 — 1.4", 1.4 =
		"1.4 — 1.5", 1.5 = "1.5 — 1.6", 1.6 = "1.6 — 1.7", 1.7 = "1.7 — 1.8", 1.8 =
		"1.8 — 1.9", 1.9 = "1.9 — 2"}
	),
	Use Value Labels( 1 ),
	Formula( 0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 ) )
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Two things here: we don't care about any scores less than 0.5 (they don't exist in your description) or greater than 1, so we can change the properties a bit and edit the label names to match what you want. I've also added an If statement to capture the edge case where a score is exactly 1&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Add Column Properties(
	Value Labels(
		{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
		"0.9 — 1"}
	),
	Use Value Labels( 1 ),
	Formula(
		If(
			(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
			0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(BTW those labels aren't technically accurate, since 0.599 would be labeled as between 0.5 and 0.59)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can wrap some code around this snippet to make it reusable, where we use the current data table, add a new column called Score Binned, and add these properties to that column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

dt &amp;lt;&amp;lt; New Column("Score Binned", Character);

dt:"Score Binned"n &amp;lt;&amp;lt; Add Column Properties(
	Value Labels(
		{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
		"0.9 — 1"}
	),
	Use Value Labels( 1 ),
	Formula(
		If(
			(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
			0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, back on our table, Tables &amp;gt; Summary takes us where we want to go. We put Group and Score Binned in Group, and that's all we actually need:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_4-1606923615913.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28705iFA92284D0D0DC2F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_4-1606923615913.png" alt="Michael_MXAK_4-1606923615913.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_5-1606923638599.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28706iAD0EAB77FC31199C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_5-1606923638599.png" alt="Michael_MXAK_5-1606923638599.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now, N Rows is what we want, it's just named wrong, so let's double-click the word "Source" on the left and copy the table creation script and replace the named table reference with "dt", our working table, and catch the new table in the variable "summ":&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_6-1606923683769.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28707iB3FFFF9555225EC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_6-1606923683769.png" alt="Michael_MXAK_6-1606923683769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

dt &amp;lt;&amp;lt; New Column("Score Binned", Character);

dt:"Score Binned"n &amp;lt;&amp;lt; Add Column Properties(
	Value Labels(
		{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
		"0.9 — 1"}
	),
	Use Value Labels( 1 ),
	Formula(
		If(
			(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
			0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
		)
	)
);

summ = dt &amp;lt;&amp;lt; Summary(
	Group( :Group, :Score Binned ),
	Freq( "None" ),
	Weight( "None" )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Finally, rename N Rows to "Total_Count" as desired:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

dt &amp;lt;&amp;lt; New Column("Score Binned", Character);

dt:"Score Binned"n &amp;lt;&amp;lt; Add Column Properties(
	Value Labels(
		{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
		"0.9 — 1"}
	),
	Use Value Labels( 1 ),
	Formula(
		If(
			(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
			0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
		)
	)
);

summ = dt &amp;lt;&amp;lt; Summary(
	Group( :Group, :Score Binned ),
	Freq( "None" ),
	Weight( "None" )
);

summ:"N Rows"n &amp;lt;&amp;lt; Set Name("Total_Count");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, close the summary table, delete the Score Binned column from the source table, and test the script:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_7-1606923867843.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28708iF0B9D2AE62782890/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_7-1606923867843.png" alt="Michael_MXAK_7-1606923867843.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final JSL again:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

dt &amp;lt;&amp;lt; New Column("Score Binned", Character);

dt:"Score Binned"n &amp;lt;&amp;lt; Add Column Properties(
	Value Labels(
		{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
		"0.9 — 1"}
	),
	Use Value Labels( 1 ),
	Formula(
		If(
			(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
			0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
		)
	)
);

summ = dt &amp;lt;&amp;lt; Summary(
	Group( :Group, :Score Binned ),
	Freq( "None" ),
	Weight( "None" )
);

summ:"N Rows"n &amp;lt;&amp;lt; Set Name("Total_Count");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Tested on your attached data, which I literally just noticed :flushed_face:&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Michael_MXAK_8-1606923973365.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/28709i3BDE4E47A8850C3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Michael_MXAK_8-1606923973365.png" alt="Michael_MXAK_8-1606923973365.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 15:46:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/338906#M58690</guid>
      <dc:creator>Michael_MXAK</dc:creator>
      <dc:date>2020-12-02T15:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Summary Data Table by Category</title>
      <link>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/338928#M58692</link>
      <description>&lt;P&gt;Here are a couple of ways to do this.&amp;nbsp; But since the example below is really just based upon primary JMP functionality, I strongly suggest that you read the Discovering JMP, and the Using JMP documents, from the JMP Documentation Library, available under the Help pull down menu.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

dt &amp;lt;&amp;lt; New Column( "Score Category",
	character,
	formula(
		If(
			:Score &amp;lt; .6, "0.50-0.59",
			:Score &amp;lt; .8, "0.60-0.79",
			:Score &amp;lt; .9, "0.80-0.89",
			"0.90-1.00",
		)
	)
);

dtSum = dt &amp;lt;&amp;lt; Summary(
	Group( :Group, :Score Category ),
	Sum( :Count ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);

dtSum &amp;lt;&amp;lt; delete columns( :N Rows );
dtSum:Name( "Sum(Count)" ) &amp;lt;&amp;lt; set name( "Total_Count" );


// or

dt:score &amp;lt;&amp;lt; set property(
	"value labels",
	{0.5 &amp;lt;= "0.50-0.59" &amp;lt; 0.6, 0.6 &amp;lt;= "0.60-0.79" &amp;lt; 0.8, 0.8 &amp;lt;= "0.80-0.89" &amp;lt; 0.9, 0.9
	 &amp;lt;= "0.90-1.00" &amp;lt;= 1}
);
	
dtSum = dt &amp;lt;&amp;lt; Summary(
	Group( :Group, :Score ),
	Sum( :Count ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);

dtSum &amp;lt;&amp;lt; delete columns( :N Rows );
dtSum:Name( "Sum(Count)" ) &amp;lt;&amp;lt; set name( "Total_Count" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Dec 2020 16:15:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/338928#M58692</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-02T16:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Summary Data Table by Category</title>
      <link>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/339112#M58720</link>
      <description>&lt;P&gt;Thanks Jim and Michael.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 13:12:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Summary-Data-Table-by-Category/m-p/339112#M58720</guid>
      <dc:creator>Lino</dc:creator>
      <dc:date>2020-12-03T13:12:06Z</dc:date>
    </item>
  </channel>
</rss>

