<?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 - How to iterate over Bivariate and save all splines to 1 column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214768#M42946</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oops. I did not see this later post and answered an earler question using Eval Expr instead of Substitute.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I didn't mean to duplicate a response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry about that, Jim.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2019 10:08:39 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2019-06-26T10:08:39Z</dc:date>
    <item>
      <title>JSL - How to iterate over Bivariate and save all splines to 1 column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214562#M42920</link>
      <description>&lt;P&gt;Hello.&amp;nbsp; I have created an array of strings, containing the various values found in one of my columns. I would like to generate a spline for every value that is in my array of strings, and save all predicted points to a new column.&amp;nbsp; I am able to iterate over Bivariate(), changing a where-clause with each iteration to a new value in my array of strings, however, only the last predicted points are saved to a new column.&amp;nbsp; How do I get all predicted points to be saved into a new column?&amp;nbsp; Thanks.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Proc = "new";
processArray = {};

DataCV=open("C:\Desktop\JMP\sample_data.csv");  

for (l = 1, l &amp;lt; 32521, l++,		// Generate array of strings
	if (proc == (Row()=l; :process), 
		print("same process"), 
		Insert Into(processArray, (Row()=l; :process)); proc = (Row()=l; :process); Show(proc)
	);
);

for (n = 1, n &amp;lt;= length(processArray), n++,	// Generate and save multiple predicteds
	biv = Bivariate(
		Y( :c_mm_deembed_pf ),
		X( :v_dut_volt ),
		Where( :c_type == "Cdg" &amp;amp; :process == processArray[n] ),// :process == processArray[n] appears to be working, as 6 splines are generated
		Fit Spline( 0.1, standardized, {save predicteds})	// {save predicteds} is not saving all 6 splines, only last spline
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17949iB9E4B73EDC2C59A1/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17948iCA676E2307F4224D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image.png" alt="Image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 22:50:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214562#M42920</guid>
      <dc:creator>adjo9835</dc:creator>
      <dc:date>2019-06-25T22:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: JSL - How to iterate over Bivariate and save all splines to 1 column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214689#M42933</link>
      <description>&lt;P&gt;Here is an annotated reworked version of your script.&amp;nbsp; Try it out.&amp;nbsp; I believe it will work with your data.&amp;nbsp; I was not able to do a real good job of testing, but any errors should be minor&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Proc = "new";
processArray = {};

DataCV = Open( "C:\Desktop\JMP\sample_data.csv" ); 


// In the commented area is a reworked version of your code that I believe
// simplifies the syntax of what you were doing.  Please review it and see 
// what changes I made.  
/*for (l = 1, l &amp;lt;= N Rows(DataCV) , l++,		// Generate array of strings
	if (proc == :process[l], 
		print("same process")
		, 
		Insert Into(processArray, :process[l]); 
		proc = :process[l]; 
		Show(proc)
	);
);*/ 

// The summarize() function is a much faster way to get the values found for 
// a spcific column or combination of columns
Summarize( DataCV, processArray = By( :process ) );

For( n = 1, n &amp;lt;= Length( processArray ), n++, 	// Generate and save multiple predicteds
	// I found that using a JSL variable in the where clause was having issues, because the formula
	// created for the Predicted values contains a reference to PredictedArray, which JSL Variable can change,
	// which makes the formula invalid.  So what needs to be done, is to subsitute the actual value for 
	// predictedArray[n] into the Where Clause
	Eval(
		Substitute(
				Expr(
					biv = Bivariate(
						Y( :c_mm_deembed_pf ),
						X( :v_dut_volt ),
						Where( :c_type == "Cdg" &amp;amp; :process == __process__ ), // :process == processArray[n] appears to be working, as 6 splines are generated
						Fit Spline( 0.1, standardized, {save predicteds} )	// {save predicteds} is not saving all 6 splines, only last spline
					)
				),
			Expr( __process__ ), processArray[n]
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 01:47:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214689#M42933</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-06-26T01:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: JSL - How to iterate over Bivariate and save all splines to 1 column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214690#M42934</link>
      <description>&lt;P&gt;And, I just thought again about the Predicted formula for the Predicted column, and realized that the process you are using is going to write on top of each other as they are processed.&amp;nbsp; I suggest that you rename the Prediced column after each execution of bivariate, forcing each iteration to end up creating a new column.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 02:06:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214690#M42934</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-06-26T02:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: JSL - How to iterate over Bivariate and save all splines to 1 column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214768#M42946</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oops. I did not see this later post and answered an earler question using Eval Expr instead of Substitute.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I didn't mean to duplicate a response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry about that, Jim.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 10:08:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214768#M42946</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-06-26T10:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: JSL - How to iterate over Bivariate and save all splines to 1 column</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214817#M42949</link>
      <description>&lt;P&gt;Try the By() role to get all predicteds in the same column. Iteration over a list is then not necessary and the generated prediction formula will automatically apply conditional statements to separate the different values of the by-column. The main difference is that all plots will share the same window.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;DataCV = Open("C:\Desktop\JMP\sample_data.csv");

DataCV &amp;lt;&amp;lt; biv = Bivariate(
    Y(:c_mm_deembed_pf),
    X(:v_dut_volt),
    By(:process),
    Where(:c_type == "Cdg"), 
    Fit Spline(0.1, Standardized, {Save Predicteds})
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jun 2019 12:03:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-How-to-iterate-over-Bivariate-and-save-all-splines-to-1/m-p/214817#M42949</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2019-06-26T12:03:52Z</dc:date>
    </item>
  </channel>
</rss>

