<?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 Running Count of Repeated Values JSL Script? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11608#M11122</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to script a running count or cumulative sum of repeated values within a column.&lt;/P&gt;&lt;P&gt;For example, first appearance should equal 1, max value of count by value specified should equal the cumulative sum of the value within the column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="149" style="border: 1px solid rgb(0, 0, 0); width: 169px; height: 151px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;color&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;count_color&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;RED&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;RED&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;BLUE&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;YELLOW&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;RED&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, the output for :count_color would not need the data table to be sorted by :color&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Mar 2015 20:36:04 GMT</pubDate>
    <dc:creator>aandw</dc:creator>
    <dc:date>2015-03-24T20:36:04Z</dc:date>
    <item>
      <title>Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11608#M11122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to script a running count or cumulative sum of repeated values within a column.&lt;/P&gt;&lt;P&gt;For example, first appearance should equal 1, max value of count by value specified should equal the cumulative sum of the value within the column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="149" style="border: 1px solid rgb(0, 0, 0); width: 169px; height: 151px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;color&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;count_color&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;RED&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;RED&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;BLUE&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;YELLOW&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;RED&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, the output for :count_color would not need the data table to be sorted by :color&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 20:36:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11608#M11122</guid>
      <dc:creator>aandw</dc:creator>
      <dc:date>2015-03-24T20:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11609#M11123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this expression in a column formula (or in a For Each Row() loop);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eval&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Eval Expr&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Col Sum&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Row&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;()&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;Expr&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Row&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;())&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;color&lt;STRONG&gt;)))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 23:24:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11609#M11123</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2015-03-24T23:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11610#M11124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using the Eval command under formula generates an output, but all values = 0&lt;/P&gt;&lt;P&gt;Perhaps I have misinterpreted. My column formula is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Running Count&lt;/P&gt;&lt;P&gt;New Column("count_color",&lt;/P&gt;&lt;P&gt;&amp;nbsp; numeric,&lt;/P&gt;&lt;P&gt;&amp;nbsp; continuous, &lt;/P&gt;&lt;P&gt;&amp;nbsp; formula(&lt;/P&gt;&lt;P&gt;&amp;nbsp; Eval(Eval Expr(Col Sum(Row() &amp;lt;= Expr(Row()), :color)))&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 14:33:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11610#M11124</guid>
      <dc:creator>aandw</dc:creator>
      <dc:date>2015-03-25T14:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11611#M11125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either paste the formula from &lt;SPAN style="font-size: 11.6999998092651px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #555555;"&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="96878" data-username="MS" href="https://community.jmp.com/people/MS" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #3778c7; text-decoration: underline;"&gt;MS&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; into the formula editor or wrap the formula in &lt;STRONG&gt;&lt;EM&gt;NameExpr&lt;/EM&gt;&lt;/STRONG&gt; (&lt;A _jive_internal="true" href="https://community.jmp.com/blogs/Uncharted/2015/03/26/column-formula"&gt;longer explanation here&lt;/A&gt;:(&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14273919436638307 jive_text_macro" jivemacro_uid="_14273919436638307"&gt;&lt;BR /&gt;&lt;P&gt;New Column( "count",&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp; Numeric,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp; "Continuous",&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp; Format( "Best", 12 ),&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp; Formula( Name Expr( Eval( Eval Expr( Col Sum( Row() &amp;lt;= Expr( Row() ), :color ) ) ) ) )&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;),&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a bug in JMP that you've helped uncover; the resulting table does not include the Name Expr( ) wrapper around the formula when the table's &amp;lt;&amp;lt;getscript command is used.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 17:55:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/11611#M11125</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2015-03-26T17:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/46668#M26591</link>
      <description>Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I am doing a similar count of all the numbers that are not zero, or else it will be changed to 1.&lt;BR /&gt;&lt;BR /&gt;If( :Number != 0,&lt;BR /&gt;Name Expr( Eval( Eval Expr( Col Sum( Row() &amp;lt;= Expr( Row() ), :Number ) ) ) ),&lt;BR /&gt;1&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;This doesn't seem to work. I get black spaces for non zero numbers. Can you help me with this? Thank you.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Nov 2017 23:22:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/46668#M26591</guid>
      <dc:creator>vishwasanj</dc:creator>
      <dc:date>2017-11-01T23:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/46688#M26603</link>
      <description>&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt; May want to ignore this. This gives a total count of each item that can be used in a script later on, but doesn't actually address the OP's real question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A somewhat more roundabout way to do this is to use the Summary platform and then read the resulting table into whatever script object you would like. I've used an associative array here.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// create temporary summary table
new = Data Table( "Untitled 8" ) &amp;lt;&amp;lt; Summary( Group( :color ) );
// make sure "Untitled 8" is the correct title of the original data, containing a column named "color"
&lt;BR /&gt;// transfer result to associative array
result = Associative Array(); // empty A.A.
For Each Row(new, result &amp;lt;&amp;lt; Insert Item(:color, :N Rows)); // populate A.A.
Show(result); // display A.A. to log

Close(new, No Save); // close temporary summary table&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 13:36:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/46688#M26603</guid>
      <dc:creator>mjoner</dc:creator>
      <dc:date>2017-11-02T13:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Running Count of Repeated Values JSL Script?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/47196#M26900</link>
      <description>&lt;P&gt;Creating a new column and assigning it the formula below does what you're after, I think:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum( 1, :Color )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Nov 2017 01:05:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-Count-of-Repeated-Values-JSL-Script/m-p/47196#M26900</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2017-11-14T01:05:41Z</dc:date>
    </item>
  </channel>
</rss>

