<?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 Formula issue in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54141#M30589</link>
    <description>&lt;P&gt;I have to manipulate data using various formulas and store the output in one final column. I am able to apply the formula successfully and store data in a new column but not in the same column.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;In this table,&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 521px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10149iB2877378794D0969/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I am using&amp;nbsp;Formula(abs(Divide(Effect,Subtract( USL,Mean)))*100)) for cells where USL values are present and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formula(abs(Divide(Effect,Subtract( Mean,LSL)))*100)) where LSL values are present. But for cells where the column name, LSL, and USL are empty, I want to use the formula:&amp;nbsp;Formula(Divide(abs(Effect)), Mean);&lt;/P&gt;
&lt;P&gt;The script I am currently working on is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtq = Open("path\formula.jmp");
a = dtq &amp;lt;&amp;lt; New Column("Final", Formula(abs(Divide(Effect,Subtract( USL,Mean)))*100));
//);
//:Final &amp;lt;&amp;lt; Formula(abs(Divide(Effect,Subtract( USL,Mean)))*100);
b = dtq &amp;lt;&amp;lt; New Column("Final1",Formula(abs(Divide(Effect,Subtract( Mean,LSL)))*100));
If( Is Empty( dtq &amp;lt;&amp;lt; ColumnName ),
:Final &amp;lt;&amp;lt; Formula(Divide(abs(Effect)), Mean);
);
show(b);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output I get now is:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 656px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10150iC7C490E154999A57/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;whereas I want the values of Final1 to be in the same column. Also,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this part of the script:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Empty( dtq &amp;lt;&amp;lt; ColumnName ),
:Final &amp;lt;&amp;lt; Formula(Divide(abs(Effect)), Mean);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;does not show any error but is not working as well. Thank you for any help.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 19:59:51 GMT</pubDate>
    <dc:creator>powerpuff</dc:creator>
    <dc:date>2018-03-29T19:59:51Z</dc:date>
    <item>
      <title>Formula issue</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54141#M30589</link>
      <description>&lt;P&gt;I have to manipulate data using various formulas and store the output in one final column. I am able to apply the formula successfully and store data in a new column but not in the same column.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;In this table,&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 521px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10149iB2877378794D0969/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I am using&amp;nbsp;Formula(abs(Divide(Effect,Subtract( USL,Mean)))*100)) for cells where USL values are present and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formula(abs(Divide(Effect,Subtract( Mean,LSL)))*100)) where LSL values are present. But for cells where the column name, LSL, and USL are empty, I want to use the formula:&amp;nbsp;Formula(Divide(abs(Effect)), Mean);&lt;/P&gt;
&lt;P&gt;The script I am currently working on is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtq = Open("path\formula.jmp");
a = dtq &amp;lt;&amp;lt; New Column("Final", Formula(abs(Divide(Effect,Subtract( USL,Mean)))*100));
//);
//:Final &amp;lt;&amp;lt; Formula(abs(Divide(Effect,Subtract( USL,Mean)))*100);
b = dtq &amp;lt;&amp;lt; New Column("Final1",Formula(abs(Divide(Effect,Subtract( Mean,LSL)))*100));
If( Is Empty( dtq &amp;lt;&amp;lt; ColumnName ),
:Final &amp;lt;&amp;lt; Formula(Divide(abs(Effect)), Mean);
);
show(b);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output I get now is:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 656px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10150iC7C490E154999A57/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;whereas I want the values of Final1 to be in the same column. Also,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this part of the script:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Empty( dtq &amp;lt;&amp;lt; ColumnName ),
:Final &amp;lt;&amp;lt; Formula(Divide(abs(Effect)), Mean);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;does not show any error but is not working as well. Thank you for any help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:59:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54141#M30589</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-03-29T19:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Formula issue</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54147#M30593</link>
      <description>&lt;P&gt;This seems a little overly complex to me. All of the calculations can be put into a single formula column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If(&lt;BR /&gt; Is Missing( :LSL ) &amp;amp; Is Missing( :USL ), Abs( :Effect / :Mean ),&lt;BR /&gt; Is Missing( :LSL ), Abs( :Effect / (:USL - :Mean) ) * 100,&lt;BR /&gt; Is Missing( :USL ), Abs( :Effect / (:Mean - :LSL) ) * 100&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It does not need to be scripted. Interactively it looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 500px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10151i757D29B0ABEAA0A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and it gives these results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.JPG" style="width: 469px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10152iFA70CC8CFC258927/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:39:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54147#M30593</guid>
      <dc:creator>Dan_Obermiller</dc:creator>
      <dc:date>2018-03-29T19:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Formula issue</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54149#M30595</link>
      <description>&lt;P&gt;Assuming a row will never have both :LSL and :USL as non-missing, this will handle all the cases you described:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	!Is Missing( :LSL ), Abs( :Effect / (:Mean - :LSL) ) * 100,
	!Is Missing( :USL ), Abs( :Effect / (:USL - :Mean) ) * 100,
	Is Missing( :ColumnName ), Abs( :Effect ) / :Mean
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:45:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54149#M30595</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-03-29T19:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Formula issue</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54157#M30600</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3194"&gt;@Dan_Obermiller&lt;/a&gt;&amp;nbsp;Thank you for the solution. I have far too many tables that I want the same formula to run on, so it would be better if a script would do it. Thanks a lot for the quick solution though..&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 20:57:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-issue/m-p/54157#M30600</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-03-29T20:57:19Z</dc:date>
    </item>
  </channel>
</rss>

