<?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 Calculating Col Mean () for a subset of rows in JSL Script? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267249#M52026</link>
    <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What us the proper syntax in JSL for calculating the column mean (or other statistics) for a variable defined &lt;U&gt;subset&lt;/U&gt; of rows? In a data table, I can just used the formula "Col Mean (:Data Column, :Grouping Column)" but in a JSL script this does not seem to be a correct usage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of note, I'm thinking of using brute force by using a "For each row" structure but that seems quite inefficient in the evaluation of 200+ columns with 1000 rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TS&lt;/P&gt;</description>
    <pubDate>Sat, 16 May 2020 20:37:24 GMT</pubDate>
    <dc:creator>Thierry_S</dc:creator>
    <dc:date>2020-05-16T20:37:24Z</dc:date>
    <item>
      <title>Calculating Col Mean () for a subset of rows in JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267249#M52026</link>
      <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What us the proper syntax in JSL for calculating the column mean (or other statistics) for a variable defined &lt;U&gt;subset&lt;/U&gt; of rows? In a data table, I can just used the formula "Col Mean (:Data Column, :Grouping Column)" but in a JSL script this does not seem to be a correct usage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of note, I'm thinking of using brute force by using a "For each row" structure but that seems quite inefficient in the evaluation of 200+ columns with 1000 rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 20:37:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267249#M52026</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2020-05-16T20:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Col Mean () for a subset of rows in JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267259#M52027</link>
      <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have come up with using the "For Each Row" structure:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1);

dt = Current Data Table ();

ALL_MEAN = Col Mean (:DATA);
MAX_MEAN = -1000;

For Each Row (
	if (MAX_MEAN &amp;lt; Col Mean(:DATA, :GROUP,:SGROUP), MAX_MEAN = Col Mean(:DATA, :GROUP,:SGROUP))
);

Show (ALL_MEAN);
Show (MAX_MEAN);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any idea on making this more efficient?&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;TS&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 21:04:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267259#M52027</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2020-05-16T21:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Col Mean () for a subset of rows in JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267262#M52028</link>
      <description>&lt;P&gt;I believe the simplest and most efficient way to do this is to use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Tables==&amp;gt;Summary&lt;/P&gt;
&lt;P&gt;This will create a data table very fast, from which you can get your statistics for your JSL, or if you need to have the&amp;nbsp; statistics back into the original data table, a simple Update with matching will do that.&amp;nbsp; Handling 200 columns and 1000 rows is not a problem at all.&amp;nbsp; Below is a simple example that will illustrate how to do this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=Open("$SAMPLE_DATA/semiconductor capability.jmp");

colNamesLIst = dt &amp;lt;&amp;lt; get column names(continuous);

dtStats = dt &amp;lt;&amp;lt; Summary(invisible,
	Group( :SITE ),
	Mean( colNamesList ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table(0)
	);
	
	dt &amp;lt;&amp;lt; Update( 
	With( dtStats ),
	Match Columns( :SITE = :SITE )
);

close( dtStats, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 May 2020 22:06:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Calculating-Col-Mean-for-a-subset-of-rows-in-JSL-Script/m-p/267262#M52028</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-16T22:06:13Z</dc:date>
    </item>
  </channel>
</rss>

