<?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 Combine columns which contain specific substring in their name in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425705#M67518</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to combine only the columns in Data table "dtPatList" which contain the substring "INIT" in their name, but it doesn't work.&lt;/P&gt;&lt;P&gt;I understand that the problem related to the parameter I bolded below. could someone advise for the right way?&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// get the dt cols names&lt;/P&gt;&lt;P&gt;nc = &lt;SPAN&gt;ncols&lt;/SPAN&gt;(dtPatList);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// get the dt cols names&lt;/P&gt;&lt;P&gt;col_list = dtPatList &amp;lt;&amp;lt; &lt;SPAN&gt;get column names&lt;/SPAN&gt;(string);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; (i = &lt;SPAN&gt;nitems&lt;/SPAN&gt;(col_list), i &amp;gt; &lt;SPAN&gt;0&lt;/SPAN&gt;, i--,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; (!&lt;SPAN&gt;contains&lt;/SPAN&gt;(col_list[i], &lt;SPAN&gt;"INIT"&lt;/SPAN&gt;)), &lt;SPAN&gt;/// new ps columns&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;remove from&lt;/SPAN&gt;(col_list, i);&lt;/P&gt;&lt;P&gt;) &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Combine init cols&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dtPatList &amp;lt;&amp;lt; &lt;SPAN&gt;Combine Columns&lt;/SPAN&gt;(&lt;/P&gt;&lt;P&gt;delimiter( &lt;SPAN&gt;"_"&lt;/SPAN&gt; ),&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;Columns(col_list)&lt;/FONT&gt;,&lt;/P&gt;&lt;P&gt;Selected Columns are Indicator Columns( &lt;SPAN&gt;0 &lt;/SPAN&gt;),&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Column Name&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;"INIT_Chain"&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 18:02:11 GMT</pubDate>
    <dc:creator>AdirZig</dc:creator>
    <dc:date>2023-06-09T18:02:11Z</dc:date>
    <item>
      <title>Combine columns which contain specific substring in their name</title>
      <link>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425705#M67518</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to combine only the columns in Data table "dtPatList" which contain the substring "INIT" in their name, but it doesn't work.&lt;/P&gt;&lt;P&gt;I understand that the problem related to the parameter I bolded below. could someone advise for the right way?&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// get the dt cols names&lt;/P&gt;&lt;P&gt;nc = &lt;SPAN&gt;ncols&lt;/SPAN&gt;(dtPatList);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// get the dt cols names&lt;/P&gt;&lt;P&gt;col_list = dtPatList &amp;lt;&amp;lt; &lt;SPAN&gt;get column names&lt;/SPAN&gt;(string);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; (i = &lt;SPAN&gt;nitems&lt;/SPAN&gt;(col_list), i &amp;gt; &lt;SPAN&gt;0&lt;/SPAN&gt;, i--,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; (!&lt;SPAN&gt;contains&lt;/SPAN&gt;(col_list[i], &lt;SPAN&gt;"INIT"&lt;/SPAN&gt;)), &lt;SPAN&gt;/// new ps columns&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;remove from&lt;/SPAN&gt;(col_list, i);&lt;/P&gt;&lt;P&gt;) &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Combine init cols&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dtPatList &amp;lt;&amp;lt; &lt;SPAN&gt;Combine Columns&lt;/SPAN&gt;(&lt;/P&gt;&lt;P&gt;delimiter( &lt;SPAN&gt;"_"&lt;/SPAN&gt; ),&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;Columns(col_list)&lt;/FONT&gt;,&lt;/P&gt;&lt;P&gt;Selected Columns are Indicator Columns( &lt;SPAN&gt;0 &lt;/SPAN&gt;),&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Column Name&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;"INIT_Chain"&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:02:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425705#M67518</guid>
      <dc:creator>AdirZig</dc:creator>
      <dc:date>2023-06-09T18:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combine columns which contain specific substring in their name</title>
      <link>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425711#M67520</link>
      <description>&lt;P&gt;Try adding Eval() inside Columns:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Columns(Eval(col_list))&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 16:06:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425711#M67520</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-10-12T16:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combine columns which contain specific substring in their name</title>
      <link>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425728#M67524</link>
      <description>&lt;P&gt;You need to place an eval() function around the col_list, to have it expanded in the function Combine Columns execution.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// get the dt cols names
dtPatlist = current data table();
nc = N Cols( dtPatList );

 

// get the dt cols names

col_list = dtPatList &amp;lt;&amp;lt; get column names( string,character );

For( i = N Items( col_list ), i &amp;gt; 0, i--, 

	If( !Contains( col_list[i], "INIT" ), /// new ps columns

		Remove From( col_list, i );

	)    

);

 

//Combine init cols 

dtPatList &amp;lt;&amp;lt; Combine Columns(

delimiter( "_" ),

Columns(eval(col_list)),

Selected Columns are Indicator Columns( 0 ),

Column Name( "INIT_Chain" )

);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 16:39:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combine-columns-which-contain-specific-substring-in-their-name/m-p/425728#M67524</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-10-12T16:39:41Z</dc:date>
    </item>
  </channel>
</rss>

