<?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: Col Median - what's wrong? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573803#M78283</link>
    <description>&lt;P&gt;I don't know of any webinar that covers that (or even discusses this issue), but it's a clever workaround to force JMP to parse that expression again. I'm really impressed with&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;'s most recent solution of including the () in the substitution, I would not have guessed that would work but it seems to help JMP recognize that you're passing in a function and it handles the rest. Surprising and interesting solution to what is a mysterious and confusing issue!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 27 Nov 2022 15:25:46 GMT</pubDate>
    <dc:creator>jules</dc:creator>
    <dc:date>2022-11-27T15:25:46Z</dc:date>
    <item>
      <title>Col Median (actually: Substitute) - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/572592#M78180</link>
      <description>&lt;P&gt;I don't understand what's wrong with this file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;height_rel&lt;/STRONG&gt; and &lt;STRONG&gt;height_rel 2&amp;nbsp;&lt;/STRONG&gt;have exactly the same Formula.&lt;/P&gt;&lt;P&gt;But in&amp;nbsp;&lt;STRONG&gt;height_rel 2&amp;nbsp;&lt;/STRONG&gt;the values are missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before saving the file, the Formula editor complained that there were too few arguments in the &lt;STRONG&gt;Col Median&lt;/STRONG&gt; funktion.&lt;/P&gt;&lt;P&gt;One could convince the Formula Editor that everything is OK by double-clicking on the formula editor and then closing all windows by clicking on OK, Ok, Ok.&lt;/P&gt;&lt;P&gt;After saving the file, this is not possible. I did not find a way to revive the formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you copy and paste the column, the &lt;STRONG&gt;copy&lt;/STRONG&gt; is OK.&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>Fri, 09 Jun 2023 16:02:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/572592#M78180</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-06-09T16:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/572621#M78182</link>
      <description>&lt;P&gt;Try going back to formula editor and press Apply. Or check Suppress Eval -&amp;gt; Apply -&amp;gt; uncheck Suppress Eval -&amp;gt; Apply again. You can also try Current Data Table() &amp;lt;&amp;lt; Rerun formulas.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 18:23:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/572621#M78182</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-23T18:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573005#M78187</link>
      <description>&lt;P&gt;Many thanks -&amp;nbsp;3 ways to fix my problem :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;Just via "OK" it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Digging deeper - why did it happen ...&lt;/P&gt;&lt;P&gt;Is there a reason why &lt;STRONG&gt;myFormula3&lt;/STRONG&gt; (with substitution of&amp;nbsp;&lt;STRONG&gt;Head&lt;/STRONG&gt; and &lt;STRONG&gt;Aggregation&lt;/STRONG&gt;) and&amp;nbsp;&lt;STRONG&gt;myFormula4&lt;/STRONG&gt;&amp;nbsp;(with subsequent substitution of&amp;nbsp;&lt;STRONG&gt;Head&lt;/STRONG&gt; and &lt;STRONG&gt;Aggregation&lt;/STRONG&gt;) don't work?&amp;nbsp;&lt;STRONG&gt;myFormula1&lt;/STRONG&gt; and &lt;STRONG&gt;myFormula2&lt;/STRONG&gt; (just substituting one of both) do.&lt;BR /&gt;(same for Jmp &lt;STRONG&gt;16.2&lt;/STRONG&gt; and Jmp 17)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;name Expr(myFormulax)&amp;nbsp;&lt;/STRONG&gt;look quite the same:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Name Expr(myFormula1) = Divide(:height, Col Median(:height));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Name Expr(myFormula2) = :height / Col Median(:height);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Name Expr(myFormula3) = Divide(:height, Col Median(:height));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Name Expr(myFormula4) = Divide(:height, Col Median(:height));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, before saving an re-opening the file none of the above 3 solutions work :(&lt;/img&gt;&lt;/P&gt;&lt;P&gt;Would be nice if a&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;Current Data Table() &amp;lt;&amp;lt; Rerun formulas;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;could solve the problem.&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;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

myFormula1 = Expr(__myHead__( :height,Col Median( :height ) ));
Substitute Into( myFormula1,
	Expr( __myHead__ ), Expr( Divide ),
					
);

myFormula2 = Expr(Divide( :height, __aggregation__( :height ) ));
Substitute Into( myFormula2,
	Expr( __aggregation__ ),Expr( Col Median )
					
);

myFormula3 = Expr(__myHead__( :height, __aggregation__( :height ) ));
Substitute Into( myFormula3,
	Expr( __myHead__ ), Expr( Divide ),
	Expr( __aggregation__ ),Expr( Col Median )					
);

myFormula4 = Expr(__myHead__( :height, __aggregation__( :height ) ));
Substitute Into( myFormula4,Expr( __myHead__ ), Expr( Divide ));
Substitute Into( myFormula4,Expr( __aggregation__ ),Expr( Col Median ));


Show( Name Expr( myFormula1 ) );
Show( Name Expr( myFormula2 ) );
Show( Name Expr( myFormula3 ) );
Show( Name Expr( myFormula4 ) );

Eval( Substitute( Expr( New Column( "new1", Formula( __f__ ) ) ), Expr( __f__ ), Name Expr( myFormula1 ) ) );
Eval( Substitute( Expr( New Column( "new2", Formula( __f__ ) ) ), Expr( __f__ ), Name Expr( myFormula2 ) ) );
Eval( Substitute( Expr( New Column( "new3", Formula( __f__ ) ) ), Expr( __f__ ), Name Expr( myFormula3 ) ) );
Eval( Substitute( Expr( New Column( "new4", Formula( __f__ ) ) ), Expr( __f__ ), Name Expr( myFormula4 ) ) );&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, 24 Nov 2022 06:44:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573005#M78187</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-24T06:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573775#M78275</link>
      <description>&lt;P&gt;What's wrong with these:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myFormula3 = Expr(__myHead__( :height, __aggregation__( :height ) ));
Substitute Into( myFormula3,
	Expr( __myHead__ ), Expr( Divide ),
	Expr( __aggregation__ ),Expr( Col Median )					
);

myFormula4 = Expr(__myHead__( :height, __aggregation__( :height ) ));
Substitute Into( myFormula4,Expr( __myHead__ ), Expr( Divide ));
Substitute Into( myFormula4,Expr( __aggregation__ ),Expr( Col Median ));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 09:41:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573775#M78275</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-27T09:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573778#M78278</link>
      <description>&lt;P&gt;I have "solved" this type of issue earlier at work, but I cannot remember anymore how and why it happened. Also haven't recorded it to my tips&amp;amp;tricks list, so cannot find the reasoning and solution easily. The second expression seems to be getting stuck if it is inside other expression when built like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One workaround:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

myFormula3 = Expr(__myHead__(:height, __aggregation__(:height)));
Substitute Into(myFormula3, Expr(__myHead__), Expr(Divide), Expr(__aggregation__), Expr(Col Median));

myFormula4 = Expr(__myHead__(:height, __aggregation__(:height)));
Substitute Into(myFormula4, Expr(__myHead__), Expr(Divide));
Substitute Into(myFormula4, Expr(__aggregation__), Expr(Col Median));

Show(Name Expr(myFormula3));
Show(Name Expr(myFormula4));

new_col = Eval(
	Substitute(
		Expr(New Column("new3", Formula(__f__))),
		Expr(__f__), Parse(Char(Name Expr(myFormula3)))
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Nov 2022 10:52:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573778#M78278</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-27T10:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573781#M78280</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I feared that I would need some nested If statements and many times the same code again to make it work.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Very cool, "dirty" workaround - thanks ;)&lt;/img&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... I wish one didn't need it:&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;&lt;LI-MESSAGE title="fix the bug in Substitute" uid="573780" url="https://community.jmp.com/t5/JMP-Wish-List/fix-the-bug-in-Substitute/m-p/573780#U573780" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/STRIKE&gt;&lt;STRIKE&gt;&lt;BR /&gt;&lt;/STRIKE&gt;edit: not needed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2026"&gt;@jules&lt;/a&gt;&amp;nbsp;: Is there a webinar which explains why the above code just works with a&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Parse(Char))?&lt;/FONT&gt;&lt;/FONT&gt;&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>Tue, 27 Jun 2023 21:01:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573781#M78280</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-06-27T21:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573784#M78281</link>
      <description>&lt;P&gt;I don't think the issue is with Substitute but rather with something else. Maybe JMP doesn't understand that Col Median is supposed to be function in this case as the replacement is a bit weird (brackets are missing). Here is most likely "correct" way to do this (note &lt;STRONG&gt;()&lt;/STRONG&gt; after &lt;STRONG&gt;Divide&lt;/STRONG&gt; and Col &lt;STRONG&gt;Median&lt;/STRONG&gt;).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

myFormula3 = Expr(__myHead__(:height, __aggregation__(:height)));
Substitute Into(myFormula3, Expr(__myHead__), Expr(Divide()), Expr(__aggregation__), Expr(Col Median()));
show(Name Expr(myFormula3));

new_col1 = Eval(
	Substitute(
		Expr(New Column("new3", Formula(__f__))),
		Expr(__f__), Name Expr(myFormula3)
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 14:29:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573784#M78281</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-11-27T14:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573802#M78282</link>
      <description>&lt;P&gt;Wow, important finding!&lt;BR /&gt;To be honest, I did not know that one has to use the brackets - I wouldn't even have bet that it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot, I definitely will add a bookmark for this post to my&amp;nbsp;&lt;SPAN&gt;tips&amp;amp;tricks list :)&lt;/img&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 15:23:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573802#M78282</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2022-11-27T15:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573803#M78283</link>
      <description>&lt;P&gt;I don't know of any webinar that covers that (or even discusses this issue), but it's a clever workaround to force JMP to parse that expression again. I'm really impressed with&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;'s most recent solution of including the () in the substitution, I would not have guessed that would work but it seems to help JMP recognize that you're passing in a function and it handles the rest. Surprising and interesting solution to what is a mysterious and confusing issue!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 15:25:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573803#M78283</guid>
      <dc:creator>jules</dc:creator>
      <dc:date>2022-11-27T15:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573805#M78285</link>
      <description>&lt;P&gt;Just to add a bit of extra mystery, it appears only one of the substituted functions needs to include the "()" so both of the formulas below will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;&lt;/EM&gt;: And upon further digging, it seems that JMP will tolerate only 1 function in an expression passed without the "()" in the substitution. Three more formulas are at the bottom where I wrap another function around your existing expression, and it will work correctly with any two functions substituted with the parentheses. I suspect there's an internal pass JMP does to make inferences about an expression in order to make it legal and it's only going to make one adjustment and then break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myFormula3 = Expr(__myHead__( :height, __aggregation__( :height ) ));
Substitute Into( myFormula3,
	Expr( __myHead__ ), Expr( Divide() ),
	Expr( __aggregation__ ),Expr( Col Median )					
);

myFormula4 = Expr(__myHead__( :height, __aggregation__( :height ) ));
Substitute Into( myFormula4,
	Expr( __myHead__ ), Expr( Divide ),
	Expr( __aggregation__ ),Expr( Col Median() )					
);&lt;/CODE&gt;&lt;/PRE&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;myFormula5 = Expr(__top__(__myHead__( :height, __aggregation__( :height ) )));
Substitute Into( myFormula5,
	Expr(__top__), Expr(Log),
	Expr( __myHead__ ), Expr( Divide),
	Expr( __aggregation__ ),Expr( Col Median )					
);

myFormula6 = Expr(__top__(__myHead__( :height, __aggregation__( :height ) )));
Substitute Into( myFormula6,
	Expr(__top__), Expr(Log()),
	Expr( __myHead__ ), Expr( Divide()),
	Expr( __aggregation__ ),Expr( Col Median )					
);

myFormula7 = Expr(__top__(__myHead__( :height, __aggregation__( :height ) )));
Substitute Into( myFormula7,
	Expr(__top__), Expr(Log()),
	Expr( __myHead__ ), Expr( Divide),
	Expr( __aggregation__ ),Expr( Col Median() )					
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 15:49:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/573805#M78285</guid>
      <dc:creator>jules</dc:creator>
      <dc:date>2022-11-27T15:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Col Median - what's wrong?</title>
      <link>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/667597#M85573</link>
      <description>&lt;P&gt;related community discussion:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;LI-MESSAGE title="Dynamically created formula not evaluating" uid="481612" url="https://community.jmp.com/t5/Discussions/Dynamically-created-formula-not-evaluating/m-p/481612#U481612" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 20:02:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-Median-actually-Substitute-what-s-wrong/m-p/667597#M85573</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-08-11T20:02:35Z</dc:date>
    </item>
  </channel>
</rss>

