<?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: Referencing Columns from other tables in a formula (Calculating Yield) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Referencing-Columns-from-other-tables-in-a-formula-Calculating/m-p/391725#M64209</link>
    <description>&lt;P&gt;Here is an example of one way to handle what you are looking to do:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="g1.JPG" style="width: 380px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33383i7077E89983AC5674/image-size/large?v=v2&amp;amp;px=999" role="button" title="g1.JPG" alt="g1.JPG" /&gt;&lt;/span&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" );
dt1 = new table("Final",
	new Column("Gender", character),
	new column("Mean"),
	new column("Count")
);

Summarize( dt, dtWaferIDList = By( :sex ) );&lt;BR /&gt;

// Loop across groups found in Summarize
// Changed to using k as an index.  There is a j() function in JMP
// and using k will avoid any confusion
For( k = 1, k &amp;lt;= N Items( dtWaferIDList ), k++,
	dt1 &amp;lt;&amp;lt; add rows( 1 );
	dt1:Gender[k] = dtWaferIDList[k];
	
	// Find rows in dt data table that match the current Gender
	theRows = dt &amp;lt;&amp;lt; get rows where( dt:sex == dtWaferIDList[k] );
	
	// Calculate Mean
	dt1:Mean[k] = Mean( dt:Height[theRows] );
	// Calculate the Count
	dt1:Count[k] = N Rows( theRows );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 08 Jun 2021 16:48:34 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-06-08T16:48:34Z</dc:date>
    <item>
      <title>Referencing Columns from other tables in a formula (Calculating Yield)</title>
      <link>https://community.jmp.com/t5/Discussions/Referencing-Columns-from-other-tables-in-a-formula-Calculating/m-p/391684#M64206</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to calculate row data by referencing columns/data found in another table.&amp;nbsp; I am trying to calculate Yield in Table #2 by pulling data from Table #1 without joining the tables.&amp;nbsp;Is there a way to do this? Here is what I have so far...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table #1 = WaferRgDt&lt;/P&gt;&lt;P&gt;Table #2 = dt1 : I am trying to populate this with data that is calculated from Table #1&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saneal_1-1623167047159.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33380i62C2800A3A496DAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saneal_1-1623167047159.png" alt="saneal_1-1623167047159.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( j = 1, j &amp;lt;= N Rows( dtWaferIDList ), j++,
	Eval(
		Parse(
			tempj = Column( dtWaferIDList, 1 )[j];
			dt1 &amp;lt;&amp;lt; select where( :Wafer == tempj);
			dt1 &amp;lt;&amp;lt; Add Rows({Wafer = tempj
			, NTested = If( Selected( Row State( Row() ) ), Col Number( :Name("FailDie")))
			, GoodDie = If( Selected( Row State( Row() ) ), Col Number( If(:Name("FailDie") == 0, 1, . )))
			, Yield = If( Selected( Row State( Row() ) ), 100 * :Name("GoodDie") / :Name("NTested"))})
		)
	)
	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The main logical issue with this code I am having is that the column "FailDie" is not a part of table dt1, but instead a part of Table #2 and I don't think it is able to read that data in its current state.&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>Sat, 10 Jun 2023 23:31:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Referencing-Columns-from-other-tables-in-a-formula-Calculating/m-p/391684#M64206</guid>
      <dc:creator>saneal</dc:creator>
      <dc:date>2023-06-10T23:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Columns from other tables in a formula (Calculating Yield)</title>
      <link>https://community.jmp.com/t5/Discussions/Referencing-Columns-from-other-tables-in-a-formula-Calculating/m-p/391725#M64209</link>
      <description>&lt;P&gt;Here is an example of one way to handle what you are looking to do:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="g1.JPG" style="width: 380px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33383i7077E89983AC5674/image-size/large?v=v2&amp;amp;px=999" role="button" title="g1.JPG" alt="g1.JPG" /&gt;&lt;/span&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" );
dt1 = new table("Final",
	new Column("Gender", character),
	new column("Mean"),
	new column("Count")
);

Summarize( dt, dtWaferIDList = By( :sex ) );&lt;BR /&gt;

// Loop across groups found in Summarize
// Changed to using k as an index.  There is a j() function in JMP
// and using k will avoid any confusion
For( k = 1, k &amp;lt;= N Items( dtWaferIDList ), k++,
	dt1 &amp;lt;&amp;lt; add rows( 1 );
	dt1:Gender[k] = dtWaferIDList[k];
	
	// Find rows in dt data table that match the current Gender
	theRows = dt &amp;lt;&amp;lt; get rows where( dt:sex == dtWaferIDList[k] );
	
	// Calculate Mean
	dt1:Mean[k] = Mean( dt:Height[theRows] );
	// Calculate the Count
	dt1:Count[k] = N Rows( theRows );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Jun 2021 16:48:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Referencing-Columns-from-other-tables-in-a-formula-Calculating/m-p/391725#M64209</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-06-08T16:48:34Z</dc:date>
    </item>
  </channel>
</rss>

