<?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 passing a variable into a Cusum script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794522#M97135</link>
    <description>&lt;P&gt;Hi Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the below script, the target value as per variable Targ of 8 is not being passed to the CuSum chart. Instead a Target value of&amp;nbsp;8.09629 is calculated and used. What's going on, and how do a pass a target value of 8 into the script ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&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 );
targ = 8;
dt = Open( "$SAMPLE_DATA/Quality Control/Oil1 Cusum.jmp" );

obj = dt &amp;lt;&amp;lt; CUSUM Control Chart( Y( :weight ), X( :hour ), Target (targ), Sigma (0.05), head start (0.05)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Sep 2024 17:34:00 GMT</pubDate>
    <dc:creator>BrianK</dc:creator>
    <dc:date>2024-09-03T17:34:00Z</dc:date>
    <item>
      <title>passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794522#M97135</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the below script, the target value as per variable Targ of 8 is not being passed to the CuSum chart. Instead a Target value of&amp;nbsp;8.09629 is calculated and used. What's going on, and how do a pass a target value of 8 into the script ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&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 );
targ = 8;
dt = Open( "$SAMPLE_DATA/Quality Control/Oil1 Cusum.jmp" );

obj = dt &amp;lt;&amp;lt; CUSUM Control Chart( Y( :weight ), X( :hour ), Target (targ), Sigma (0.05), head start (0.05)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2024 17:34:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794522#M97135</guid>
      <dc:creator>BrianK</dc:creator>
      <dc:date>2024-09-03T17:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794553#M97136</link>
      <description>&lt;P&gt;You can evaluate it there for example by using Eval(EvalExpr())&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
targ = 8;
dt = Open("$SAMPLE_DATA/Quality Control/Oil1 Cusum.jmp");

Eval(EvalExpr(
	obj = dt &amp;lt;&amp;lt; CUSUM Control Chart(
		Y(:weight),
		X(:hour),
		Target(Expr(targ)),
		Sigma(0.05),
		head start(0.05)
	);	
));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2024 17:33:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794553#M97136</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-03T17:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794554#M97137</link>
      <description>&lt;P&gt;Perfect. Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 17:40:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794554#M97137</guid>
      <dc:creator>BrianK</dc:creator>
      <dc:date>2024-09-03T17:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794597#M97138</link>
      <description>&lt;P&gt;based on solution above, how would I now implement similar for multiple CuSum charts where By: is used, but all having different target values depending on the day.. So in the following script&amp;nbsp; example, If Day =1, targ = 6. if day =2, targ = 7, etc,etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Names Default To Here(1);&lt;/DIV&gt;&lt;DIV&gt;targ = 6;&lt;/DIV&gt;&lt;DIV&gt;dt = Open("$SAMPLE_DATA/Quality Control/Vial Fill Weights.jmp");&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Eval(EvalExpr(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;obj = dt &amp;lt;&amp;lt; CUSUM Control Chart(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Y(:Fill Weight),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;X(:Sample),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Target(Expr(targ)),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;By (:Day)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;));&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;Names Default To Here(1);
targ = 8;
dt = Open("$SAMPLE_DATA/Quality Control/Oil1 Cusum.jmp");

Eval(EvalExpr(
	obj = dt &amp;lt;&amp;lt; CUSUM Control Chart(
		Y(:weight),
		X(:hour),
		Target(Expr(targ)),
		Sigma(0.05),
		head start(0.05)
	);	
));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 19:01:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794597#M97138</guid>
      <dc:creator>BrianK</dc:creator>
      <dc:date>2024-09-03T19:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794599#M97139</link>
      <description>&lt;P&gt;It gets a bit more complicated if you wish to use By variable. I would most likely loop over each of the platforms (this might be different between JMP versions). This hopefully gives some idea of what you could do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Quality Control/Vial Fill Weights.jmp");

targs = ["1" =&amp;gt; 5, "2" =&amp;gt; 6, "3" =&amp;gt; 7, "4" =&amp;gt; 8, "5" =&amp;gt; 9];

Eval(
	Eval Expr(
		ccs = dt &amp;lt;&amp;lt; CUSUM Control Chart(
			Y(:Fill Weight),
			X(:Sample),
			By(:Day)
		)
	)
);

For Each({cur_cc}, ccs,
	cur_rep = Report(cur_cc);
	cur_day = Word(-1, (cur_rep &amp;lt;&amp;lt; get title), "=");
	Eval(EvalExpr(
		cur_cc &amp;lt;&amp;lt; Target(Expr(targs[cur_day]));
	));
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Basically I have "spec" associative array, then I get the "filtered" value using Word(-1,...), retrieve value from associative array with that and use it to set the target&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 19:08:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794599#M97139</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-03T19:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794706#M97146</link>
      <description>&lt;P&gt;Awesome. Thank you so much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 21:54:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/794706#M97146</guid>
      <dc:creator>BrianK</dc:creator>
      <dc:date>2024-09-03T21:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: passing a variable into a Cusum script</title>
      <link>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/798512#M97437</link>
      <description>&lt;P&gt;Thank you so much for the solution&lt;/P&gt;&lt;LI-SPOILER&gt;It sounds like your script is experiencing an issue where the target value is being rounded or recalculated, resulting in a value of 8.09629 instead of the desired 8. To ensure the target value of 8 is correctly passed to the CuSum chart, check your script for any rounding or calculation functions that might be altering the target value. Ensure that the target value is explicitly set and used without any modifications. Verify data types and ensure no implicit conversions are affecting the precision. School deadlines can be overwhelming, but with &lt;A href="https://liahelp.com" target="_blank"&gt;https://liahelp.com&lt;/A&gt; it’s a lot easier to manage. The site offers academic writing services like essays and research papers, all of which are guaranteed to be original. Their customer support is quick and helpful, making sure you get what you need. I also love that they offer revisions, so the final product is just what I wanted. Definitely recommend it for students!&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sat, 21 Sep 2024 11:10:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/passing-a-variable-into-a-Cusum-script/m-p/798512#M97437</guid>
      <dc:creator>AidenTorres</dc:creator>
      <dc:date>2024-09-21T11:10:47Z</dc:date>
    </item>
  </channel>
</rss>

