<?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: Need help with Column formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803626#M98069</link>
    <description>&lt;P&gt;Calculating PAT limits. I want to link the formula with a table variable, which will allow me to vary the factor value from a GUI&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2024 15:30:44 GMT</pubDate>
    <dc:creator>Jackie_</dc:creator>
    <dc:date>2024-10-04T15:30:44Z</dc:date>
    <item>
      <title>Need help with Column formula</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803603#M98064</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert this loop into an equivalent column formula&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
// Assuming Column B is column 2
testColumn = Column( dt, 1 );
llCol = dt &amp;lt;&amp;lt; New Column( "LL Limit_7.5", Numeric );
ulCol = dt &amp;lt;&amp;lt; New Column( "UL Limit_7.5", Numeric );
// Loop through each row starting from row 20
For( i = 20, i &amp;lt;= N Rows( dt ), i++,
	data = testColumn[1 :: i]; // Get values from row 20 to the current row
	q1 = Quantile( 0.25, data ); // 1st Quartile
	q3 = Quantile( 0.75, data ); // 3rd Quartile
	// Factor value is 6
	factorValue = 7.5;
   // Calculate ll and ul
	llx = q1 - (q3 - q1) * (factorValue - 0.675) / 1.35;
	ulx = q3 + (q3 - q1) * (factorValue - 0.675) / 1.35;
   // Set the calculated values in the new columns
	llCol[i] = llx;
	ulCol[i] = ulx;
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried but it doesn't seem to be correct. Any advice?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;newColExpr = Expr(
	llCol &amp;lt;&amp;lt; Set Formula(
		If( Row() &amp;gt;= 20,
			Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) ) - (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
			-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
			.
		)
	);
	ulCol &amp;lt;&amp;lt; Set Formula(
		If( Row() &amp;gt;= 20,
			Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) ) + (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
			-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
			.
		)
	);
);
Eval( Eval Expr( newColExpr ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Oct 2024 15:07:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803603#M98064</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2024-10-04T15:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Column formula</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803625#M98068</link>
      <description>&lt;P&gt;Could you explain what you wish to do?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 15:23:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803625#M98068</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-04T15:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Column formula</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803626#M98069</link>
      <description>&lt;P&gt;Calculating PAT limits. I want to link the formula with a table variable, which will allow me to vary the factor value from a GUI&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 15:30:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803626#M98069</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2024-10-04T15:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Column formula</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803628#M98070</link>
      <description>&lt;P&gt;You can do something like this but I'm not exactly sure if it is the best way to go with this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$DOWNLOADS/data_table.jmp");


dt &amp;lt;&amp;lt; New Column("Low", Numeric, Continuous, Formula(
	As Constant(
		factorValue = 7.5;
	);
	If(Row() &amp;lt; 20,
		.
	,
		m = :Data[1::Row()];
		q1 = Quantile(0.25, m);
		q3 = Quantile(0.75, m);
		q1 - (q3 - q1) * (factorValue - 0.675) / 1.35;
	);
));

dt &amp;lt;&amp;lt; New Column("High", Numeric, Continuous, Formula(
	As Constant(
		factorValue = 7.5;
	);
	If(Row() &amp;lt; 20,
		.
	,
		m = :Data[1::Row()];
		q1 = Quantile(0.25, m);
		q3 = Quantile(0.75, m);
		q3 + (q3 - q1) * (factorValue - 0.675) / 1.35;
	);
));

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Oct 2024 15:31:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803628#M98070</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-04T15:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Column formula</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803631#M98072</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1728055820645.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68825iE792451DB77BFD69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1728055820645.png" alt="hogi_0-1728055820645.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Interesting, for Col Quantiles, it's&amp;nbsp; &lt;U&gt;first the column&lt;/U&gt;, then the Quantile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Besides that,&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Col Quantile&lt;/FONT&gt; will take all rows - not rows &lt;FONT face="courier new,courier"&gt;1::currentRow&lt;/FONT&gt;&lt;BR /&gt;-&amp;gt; will result in a constant value.&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_1-1728055938230.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68826i1960389B96F30166/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1728055938230.png" alt="hogi_1-1728055938230.png" /&gt;&lt;/span&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;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;newColExpr = Expr(
	new column("llCol" ,Formula(
		If( Row() &amp;gt;= 20,
			Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) ) - (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
			-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
			.
		)
	));
	new column("ulCol" ,  Formula(
		If( Row() &amp;gt;= 20,
			Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) ) + (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
			-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
			.
		)
	));
);
 Eval(Eval Expr( newColExpr )) ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 15:35:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-with-Column-formula/m-p/803631#M98072</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-04T15:35:50Z</dc:date>
    </item>
  </channel>
</rss>

