<?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: How to add column in subset tables and add value based on specific column value? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779752#M96096</link>
    <description>&lt;P&gt;After I have subset the table, how can I create a loop to add a column "Ref" on all the subsetted tables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Will rephrase the question&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2024 01:43:50 GMT</pubDate>
    <dc:creator>UserID16644</dc:creator>
    <dc:date>2024-08-07T01:43:50Z</dc:date>
    <item>
      <title>How to create a loop and add column in subset tables and add value based on specific column value?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779732#M96094</link>
      <description>&lt;P&gt;Hi all, I have a table subset&lt;/P&gt;&lt;P&gt;I have two questions.&lt;/P&gt;&lt;P&gt;1. How can create a loop that adds column "Ref" to every subset table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Also, is it possible that the value of the created column will be based on the highest number of N Rows with a specific value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the &lt;U&gt;new column to be added&lt;/U&gt; will be &lt;STRONG&gt;Ref&lt;/STRONG&gt;. Column Ref's value will be based on Column Country, wherein it should add 1 to the highest N Rows Value of America only.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;N Rows&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Ref&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Argentina&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;America&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;America&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Canada&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 01:46:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779732#M96094</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-08-07T01:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add column in subset tables and add value based on specific column value?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779746#M96095</link>
      <description>&lt;P&gt;I am not sure what your definition of as "column subset" is.&amp;nbsp; Is what you are referring to, the data tables created from&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Tables=&amp;gt;Subset&lt;/P&gt;
&lt;P&gt;when&amp;nbsp; Subset By is checked&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1722993661568.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66895i3B1180450995D867/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1722993661568.png" alt="txnelson_0-1722993661568.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and a separate table for each level of the variable(s) selected is made?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 01:24:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779746#M96095</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-07T01:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add column in subset tables and add value based on specific column value?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779752#M96096</link>
      <description>&lt;P&gt;After I have subset the table, how can I create a loop to add a column "Ref" on all the subsetted tables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Will rephrase the question&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 01:43:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779752#M96096</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-08-07T01:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to add column in subset tables and add value based on specific column value?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779753#M96097</link>
      <description>&lt;P&gt;Here is an example of one way to do the looping.&amp;nbsp; The real issue is how to get the list of tables to loop across.&amp;nbsp; This example assumes that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Tables=&amp;gt;Subset&lt;/P&gt;
&lt;P&gt;with a Subset By was used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dtSubsetList = dt &amp;lt;&amp;lt; Subset(
	By( :sex ),
	All rows,
	Selected columns only( 0 ),
	columns( :name, :age, :height, :weight )
);

for each( {table}, dtSubsetList,
	table &amp;lt;&amp;lt; new column( "Ref");
	wait(0);
	table:ref[table &amp;lt;&amp;lt; get rows where( :age == col max(:age))]=1;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2024 02:01:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779753#M96097</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-07T02:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to add column in subset tables and add value based on specific column value?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779755#M96098</link>
      <description>&lt;P&gt;What if my data looks like this? The column Country is in character type, how can I get its highest N Rows? Assuming that I am getting the highest N Rows from America. From the example you have given, I think it is in numeric data type&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;N Rows&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Ref&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Argentina&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;America&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;America&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Canada&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 07 Aug 2024 02:23:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779755#M96098</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-08-07T02:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to add column in subset tables and add value based on specific column value?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779760#M96099</link>
      <description>&lt;P&gt;I assume something similar to this will be what you need&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;table:ref[table &amp;lt;&amp;lt; get rows where( :Country == "America" &amp;amp; :N Rows == col max(:N Rows, :Country))]=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suggest you take the time to read the Scripting Guide, to learn JSL.&amp;nbsp; If you are not familiar with programming and at least one programming language, I suggest you search the internet for a free course on "Learn how to Program".&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 02:46:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-loop-and-add-column-in-subset-tables-and-add/m-p/779760#M96099</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-08-07T02:46:18Z</dc:date>
    </item>
  </channel>
</rss>

