<?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: create new column and set each row value from different column based on another column (column name variable) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896972#M105703</link>
    <description>&lt;P&gt;for only few column I think I can use if condition like below, but I have too many columns. So I wonder if there is a wayto use MaxCOl value as variable to call the column.&lt;/P&gt;
&lt;P&gt;if only few columns, below can work:&lt;/P&gt;
&lt;P&gt;if(:MaxCol =="Lily", :Lily_t,&lt;/P&gt;
&lt;P&gt;:MaxCol =="Mike", :Mike_t,&lt;/P&gt;
&lt;P&gt;:MaxCol =="Dan", :Dan_t,&lt;/P&gt;
&lt;P&gt;)&lt;BR /&gt;&lt;BR /&gt;hoping to have something simple as below when I have hundreds of columns&lt;/P&gt;
&lt;P&gt;MaxValFromCol == Column(char(:MaxCol)||"_t")&lt;/P&gt;</description>
    <pubDate>Tue, 26 Aug 2025 03:46:37 GMT</pubDate>
    <dc:creator>dadawasozo</dc:creator>
    <dc:date>2025-08-26T03:46:37Z</dc:date>
    <item>
      <title>create new column and set each row value from different column based on another column (column name variable)</title>
      <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896943#M105698</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dadawasozo_0-1756165127850.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81212i0A926F14A3AF620B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dadawasozo_0-1756165127850.png" alt="dadawasozo_0-1756165127850.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have data similar to example in picture. first 6 columns are related. I created MaxCol to find out who has the Max which based on first 3 columns, then I want to create MaxValFromCol column where it take value from one of the column from 4-6. it will pick value from column 4-6 based on MaxCol. I tried to set the value of MaxValFromCol using Column(char(:MaxCol) || "_t"), but not success. Can someone give some suggestion how we can take a column value as column name and set value based on it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Aug 2025 23:47:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896943#M105698</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2025-08-25T23:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: create new column and set each row value from different column based on another column (column name variable)</title>
      <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896968#M105701</link>
      <description>&lt;P&gt;Here is the formula I came up with for MaxCol&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	startCol = 1;
	endCol = 3;
	nCol = (endCol - startCol) + 1;
	dt = Current Data Table();
	colNames = dt &amp;lt;&amp;lt; get column names;
);
theMax = Loc( dt[Row(), Index( startCol, endCol )], Max( dt[Row(), Index( startCol, endCol )] ) );
theMax = (theMax + startCol) - 1;
colNames[theMax][1];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and here is the formula for MaxValFromCol&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	startCol = 1;
	endCol = 3;
	nCol = (endCol - startCol) + 1;
	dt = Current Data Table();
	colNames = dt &amp;lt;&amp;lt; get column names();
);
theMax = Loc( dt[Row(), Index( startCol, endCol )], Max( dt[Row(), Index( startCol, endCol )] ) )
+ncol;
Parse( Char( colNames[themax][1] ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1756178659229.png" style="width: 656px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81216i1E0EB665F066D5FC/image-dimensions/656x223?v=v2" width="656" height="223" role="button" title="txnelson_0-1756178659229.png" alt="txnelson_0-1756178659229.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is late at night, and I am sure others will have better solutions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2025 03:25:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896968#M105701</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-08-26T03:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: create new column and set each row value from different column based on another column (column name variable)</title>
      <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896970#M105702</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I able to get the MaxCol What I want the MaxValFromCol to be is the value from column 4-6, not the column name. For example, row 1 i MaxCol =="Lily", then the row 1 of MaxValFromCol will take value from Lily_t, which is 4|5. the Row 2 is 4|4 because row 2 of MaxCol is Mike, so that 4|4 come from Mike_t&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dadawasozo_0-1756179233754.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81217i0B619A1B1B8BE628/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dadawasozo_0-1756179233754.png" alt="dadawasozo_0-1756179233754.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2025 03:35:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896970#M105702</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2025-08-26T03:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: create new column and set each row value from different column based on another column (column name variable)</title>
      <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896972#M105703</link>
      <description>&lt;P&gt;for only few column I think I can use if condition like below, but I have too many columns. So I wonder if there is a wayto use MaxCOl value as variable to call the column.&lt;/P&gt;
&lt;P&gt;if only few columns, below can work:&lt;/P&gt;
&lt;P&gt;if(:MaxCol =="Lily", :Lily_t,&lt;/P&gt;
&lt;P&gt;:MaxCol =="Mike", :Mike_t,&lt;/P&gt;
&lt;P&gt;:MaxCol =="Dan", :Dan_t,&lt;/P&gt;
&lt;P&gt;)&lt;BR /&gt;&lt;BR /&gt;hoping to have something simple as below when I have hundreds of columns&lt;/P&gt;
&lt;P&gt;MaxValFromCol == Column(char(:MaxCol)||"_t")&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2025 03:46:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896972#M105703</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2025-08-26T03:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: create new column and set each row value from different column based on another column (column name variable)</title>
      <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896973#M105704</link>
      <description>&lt;P&gt;My error.......late at night......I will correct.&lt;/P&gt;
&lt;P&gt;Here are the 2 formulas that I have working&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1756183192612.png" style="width: 624px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81221i1E95B83B62AA0EE1/image-dimensions/624x195?v=v2" width="624" height="195" role="button" title="txnelson_0-1756183192612.png" alt="txnelson_0-1756183192612.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;As Constant(
	startCol = 1;
	endCol = 3;
	nCol = (endCol - startCol) + 1;
	dt = Current Data Table();
	colNames = dt &amp;lt;&amp;lt; get column names( string );
);
theMax = Loc( dt[Row(), Index( startCol, endCol )], Max( dt[Row(), Index( startCol, endCol )] ) );
theMax = (theMax + startCol) - 1;
x = colNames[theMax][1];
x;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	startCol = 1;
	endCol = 3;
	nCol = (endCol - startCol) + 1;
	dt = Current Data Table();
	colNames = dt &amp;lt;&amp;lt; get column names( string );
);
theMax = Loc( dt[Row(), Index( startCol, endCol )], Max( dt[Row(), Index( startCol, endCol )] ) )
+ncol;
Eval( Parse( "x=:" || colNames[theMax][1] ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Aug 2025 04:40:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896973#M105704</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-08-26T04:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: create new column and set each row value from different column based on another column (column name variable)</title>
      <link>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896976#M105706</link>
      <description>&lt;P&gt;Not really sure I would use something like this, but it might work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Column(Column(:Column 1 ||"_t"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also most likely drop the Column()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Column(:Column 1 || "_t")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Aug 2025 04:31:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/create-new-column-and-set-each-row-value-from-different-column/m-p/896976#M105706</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-08-26T04:31:05Z</dc:date>
    </item>
  </channel>
</rss>

