<?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: Can the calculations of these two steps be modified to be completed in one step? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902402#M106136</link>
    <description>&lt;P&gt;none of the weights is empty.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;weight[Index(Row()-9,Row())]&amp;amp;height[Index(Row()-9,Row())]&amp;gt;=height[Index(Row()-10,Row()-1)]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;can be reduced to&amp;nbsp;&lt;BR /&gt;&lt;CODE class=" language-jsl"&gt;height[Index(Row()-9,Row())]&amp;gt;=height[Index(Row()-10,Row()-1)]&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;or maybe: you wanted to calculate something else?&lt;BR /&gt;&lt;BR /&gt;selection of A &amp;amp; B.&lt;BR /&gt;comparison of C&amp;amp;DD:&lt;/img&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1758459727481.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83062i72A6B0D2474AD6A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1758459727481.png" alt="hogi_0-1758459727481.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;let's challenge it:&lt;BR /&gt;a)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;weight[11] = 500;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;b)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;current data table()&amp;lt;&amp;lt; add rows(10);
height[41::50] = 70;
weight[41::50] = 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Sep 2025 13:13:19 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2025-09-21T13:13:19Z</dc:date>
    <item>
      <title>Can the calculations of these two steps be modified to be completed in one step?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902375#M106134</link>
      <description>&lt;P&gt;Thanks Experts!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=Open("$SAMPLE_DATA/Big Class.jmp");
ca="A";If(Is Missing(Try(Column(ca)&amp;lt;&amp;lt;Get Name)),New Column(ca));Column(ca)&amp;lt;&amp;lt;Formula( if(height&amp;gt;=lag(height,1),weight) );Current Data Table()&amp;lt;&amp;lt;run formulas;Column(ca)&amp;lt;&amp;lt;deleteFormula;
ca="B";If(Is Missing(Try(Column(ca)&amp;lt;&amp;lt;Get Name)),New Column(ca));Column(ca)&amp;lt;&amp;lt;Formula( if(height&amp;lt;lag(height,1),weight) );Current Data Table()&amp;lt;&amp;lt;run formulas;Column(ca)&amp;lt;&amp;lt;deleteFormula;
ca="C";If(Is Missing(Try(Column(ca)&amp;lt;&amp;lt;Get Name)),New Column(ca));Column(ca)&amp;lt;&amp;lt;Formula( if(row()&amp;gt;9,round(sum(A[Index(Row()-9,Row())])/sum(B[Index(Row()-9,Row())]),2) ));Current Data Table()&amp;lt;&amp;lt;run formulas;Column(ca)&amp;lt;&amp;lt;deleteFormula;

ca="D";If(Is Missing(Try(Column(ca)&amp;lt;&amp;lt;Get Name)),New Column(ca));Column(ca)&amp;lt;&amp;lt;Formula(  if(row()&amp;gt;9,sum(weight[Index(Row()-9,Row())]&amp;amp;height[Index(Row()-9,Row())]&amp;gt;=height[Index(Row()-10,Row()-1)])/sum(weight[Index(Row()-9,Row())]&amp;amp;height[Index(Row()-9,Row())]&amp;lt;height[Index(Row()-10,Row()-1)])) );Current Data Table()&amp;lt;&amp;lt;run formulas;Column(ca)&amp;lt;&amp;lt;deleteFormula;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-09-21_17-40-41.png" style="width: 954px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83044iC4F2464B26238C93/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-09-21_17-40-41.png" alt="2025-09-21_17-40-41.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2025 09:42:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902375#M106134</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2025-09-21T09:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can the calculations of these two steps be modified to be completed in one step?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902399#M106135</link>
      <description>&lt;P&gt;(assuming your goal is either speed, or easier to read code...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column formulas are not magic. They are not faster than JSL. They are JSL.&lt;/P&gt;
&lt;P&gt;OK, they can be a little bit magic; JMP's engine that evaluates columns does figure out which columns are dependent on other columns and evaluate the not-dependent formulas first. But that never happens here since the formulas are deleted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are creating / running / deleting the formula to populate a column, four times, you might want to try a single JSL loop with the four inner statements inside. Be sure to use the &amp;lt;&amp;lt;beginDataUpdate before the loop and &amp;lt;&amp;lt;endDataUpdate after the loop. I don't expect this to be a lot faster, but it might be a lot easier to read. (Your example has some repeated computations that could be streamlined in a single loop.) You can probably use ForEachRow(dt, ... ) and get the same looping speed that &amp;lt;&amp;lt;runformulas has.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2025 12:28:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902399#M106135</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2025-09-21T12:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can the calculations of these two steps be modified to be completed in one step?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902402#M106136</link>
      <description>&lt;P&gt;none of the weights is empty.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;weight[Index(Row()-9,Row())]&amp;amp;height[Index(Row()-9,Row())]&amp;gt;=height[Index(Row()-10,Row()-1)]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;can be reduced to&amp;nbsp;&lt;BR /&gt;&lt;CODE class=" language-jsl"&gt;height[Index(Row()-9,Row())]&amp;gt;=height[Index(Row()-10,Row()-1)]&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;or maybe: you wanted to calculate something else?&lt;BR /&gt;&lt;BR /&gt;selection of A &amp;amp; B.&lt;BR /&gt;comparison of C&amp;amp;DD:&lt;/img&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1758459727481.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83062i72A6B0D2474AD6A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1758459727481.png" alt="hogi_0-1758459727481.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;let's challenge it:&lt;BR /&gt;a)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;weight[11] = 500;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;b)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;current data table()&amp;lt;&amp;lt; add rows(10);
height[41::50] = 70;
weight[41::50] = 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2025 13:13:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902402#M106136</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-09-21T13:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can the calculations of these two steps be modified to be completed in one step?</title>
      <link>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902406#M106137</link>
      <description>&lt;P&gt;I need this form composed of several formulas and don't want any loops in it.&lt;BR /&gt;Thanks Experts!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa="";
current data table(dt);Eval(Parse("Column(dt,\!"ABC\!")&amp;lt;&amp;lt;Formula("||aaa||")"));dt&amp;lt;&amp;lt;run formulas;Column("ABC")&amp;lt;&amp;lt;deleteFormula;s=N Rows(Loc(dt[0,"ABC"]&amp;gt;0));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 21 Sep 2025 13:56:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Can-the-calculations-of-these-two-steps-be-modified-to-be/m-p/902406#M106137</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2025-09-21T13:56:21Z</dc:date>
    </item>
  </channel>
</rss>

