<?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: JSL for converting a formula to its results in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379019#M62882</link>
    <description>&lt;P&gt;Cooler! I'd assumed each value had to be set to the same value.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Apr 2021 15:22:11 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2021-04-22T15:22:11Z</dc:date>
    <item>
      <title>JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378935#M62868</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have the following jsl code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column( "I (%)", (:Mean * 100) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that takes a column (Mean), multiplies by 100 and create a new column called I(%) with the formula.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not want the formula but just the result of the calculation in the new column. How can I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:45:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378935#M62868</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2023-06-09T19:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378947#M62869</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

// Sample table
dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Add a formula column
dt &amp;lt;&amp;lt; NewColumn("BMI", Numeric, Continuous, Formula(:weight/(:height^2)));

// Make sure the formula is run
dt &amp;lt;&amp;lt; runFormulas;

// Wait a little, then remove the formula
Wait(3);
Column(dt, "BMI") &amp;lt;&amp;lt; deleteFormula;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 09:59:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378947#M62869</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-04-22T09:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378964#M62870</link>
      <description>&lt;P&gt;The wait(3) is just so you can watch it; it is not required after &amp;lt;&amp;lt;RunFormulas.&lt;/P&gt;&lt;P&gt;You can also use the formula editor to clear the formula for the same effect.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 11:51:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378964#M62870</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-04-22T11:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378992#M62873</link>
      <description>&lt;P&gt;Try using &amp;lt;&amp;lt;Set Each Value() instead of Formula()&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 12:51:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378992#M62873</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-04-22T12:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378994#M62874</link>
      <description>&lt;P&gt;You do not need a formula at all. I recommend not using column formulas when scripting unless you want the values to dynamically change after the script is done. So your case could be solved this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column( "I (%)", Numeric, Continuous, Values( (:Mean &amp;lt;&amp;lt; Get Values) * 100) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 12:56:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378994#M62874</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-04-22T12:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378995#M62875</link>
      <description>&lt;P&gt;Cool!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 13:02:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/378995#M62875</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-04-22T13:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379004#M62878</link>
      <description>&lt;P&gt;That message is not helpful in this case. It is used to set every row in the target column to the same constant value.&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="set each.PNG" style="width: 393px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32281i842DB638A72AD19C/image-size/large?v=v2&amp;amp;px=999" role="button" title="set each.PNG" alt="set each.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 14:09:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379004#M62878</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-04-22T14:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379007#M62879</link>
      <description>&lt;P&gt;Hee is a simple example using Set Each Value&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt=open("$SAMPLE_DATA\big class.jmp");

dt &amp;lt;&amp;lt; new column("times100", numeric, continuous, set each value(:height*100));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="set.PNG" style="width: 604px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32282i8946635B43B1BC0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="set.PNG" alt="set.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 14:26:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379007#M62879</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-04-22T14:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379019#M62882</link>
      <description>&lt;P&gt;Cooler! I'd assumed each value had to be set to the same value.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 15:22:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379019#M62882</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-04-22T15:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379051#M62890</link>
      <description>&lt;P&gt;That behavior is the intended purpose of the &amp;lt;&amp;lt; Set Each Value message as it is documented.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 17:19:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379051#M62890</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-04-22T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379101#M62904</link>
      <description>&lt;P&gt;This maybe gets a bit out of topic and I can create different post to discuss this further...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even though the documentation is what it is for Set Each Value (JMP documentation isn't always exactly on point...) I feel like it is the easiest way the way to handle cases like this. You can easily use complicated "formulas" with Set Each Value without worrying about removing the formulas later. With Values() the calculations might get a bit more difficult to do, see my example (I'm definitely not proficient with JSL Matrices so there is most likely way easier way to do what I did in my example).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example with Formulas, Set Each Value and Values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

//With formulas
newCol = dt &amp;lt;&amp;lt; New Column("Formula_simple", Numeric, Continuous, Formula(:height*:weight));
newCol &amp;lt;&amp;lt; Delete Formula;
newCol = dt &amp;lt;&amp;lt; New Column("Formula_ColMin", Numeric, Continuous, Formula(:height*ColMin(:weight, :sex)));
newCol &amp;lt;&amp;lt; Delete Formula;

//With Set Each Value
newCol = dt &amp;lt;&amp;lt; New Column("SetEach_simple", Numeric, Continuous, Set Each Value(:height*:weight));
newCol = dt &amp;lt;&amp;lt; New Column("SetEach_ColMin", Numeric, Continuous, Set Each Value(:height * ColMin(:weight, :sex)));

//With Values
newCol = dt &amp;lt;&amp;lt; New Column("Values_simple", Numeric, Continuous, Values((:height &amp;lt;&amp;lt; get values) :* (:weight&amp;lt;&amp;lt; get values)));
newCol = dt &amp;lt;&amp;lt; New Column("Values_ColMin", Numeric, Continuous, Values(
	Summarize(exg = By(:sex), exm = Min(:weight)); //get min values by group
	m_val = J(N Rows(dt),1,1);//matrix for values
	height_vec = :height &amp;lt;&amp;lt; get values;
	For(i = 1, i &amp;lt;= N Items(exg), i++, //loop to "fill" matrix for values
		tempRows = Loc(:sex &amp;lt;&amp;lt; get as matrix, exg[i]);
		m_val[tempRows] = height_vec[tempRows] * exm[i];
	);
	m_val;
));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What does Set Each Value do behind the scenes because it seems to work just fine? Should the documentation maybe be updated to include this behavior or new function created to do this? It could break quite many scripts people have if Set Each Values behavior were to be changed.&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>Thu, 22 Apr 2021 19:26:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379101#M62904</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-04-22T19:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379642#M62959</link>
      <description>Thank you very much, very useful.</description>
      <pubDate>Mon, 26 Apr 2021 08:06:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379642#M62959</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2021-04-26T08:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379643#M62960</link>
      <description>Thanks! Very clear.</description>
      <pubDate>Mon, 26 Apr 2021 08:06:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379643#M62960</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2021-04-26T08:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for converting a formula to its results</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379644#M62961</link>
      <description>Many thanks.</description>
      <pubDate>Mon, 26 Apr 2021 08:06:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-converting-a-formula-to-its-results/m-p/379644#M62961</guid>
      <dc:creator>MFVIT</dc:creator>
      <dc:date>2021-04-26T08:06:52Z</dc:date>
    </item>
  </channel>
</rss>

