<?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: Script to Delete Columns Not Containing a Certain Word in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-Delete-Columns-Not-Containing-a-Certain-Word/m-p/85907#M38374</link>
    <description>&lt;P&gt;Here are the minor changes to your code to make it work.&amp;nbsp; Note the looping going from the last column to your 11th column.&amp;nbsp; That allows for using the column number for deleting.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1_new = Current Data Table();

For( i = N Cols( dt1_new ), i &amp;gt;= 11, i--, // set number of columns to start looking at
	If( Contains( Column( dt1_new, i ) &amp;lt;&amp;lt; Get Name, "4C4QC30.0.Cv" ) == 0,
		dt1_new &amp;lt;&amp;lt; Delete Columns( i )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Dec 2018 18:29:07 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-12-15T18:29:07Z</dc:date>
    <item>
      <title>Script to Delete Columns Not Containing a Certain Word</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Delete-Columns-Not-Containing-a-Certain-Word/m-p/85894#M38363</link>
      <description>&lt;P&gt;Hi, how do I write a script to delete columns not containing a certain word? I would like to delete column names that do not have the word "4C4QC30.0" in them&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Column.PNG" style="width: 523px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14847iF939176AB67C6194/image-size/large?v=v2&amp;amp;px=999" role="button" title="Column.PNG" alt="Column.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My script below unfortunately does not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;For&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;( i = &lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;11&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, i &amp;lt;= &lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;N Cols&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;( dt1_new ), i++, &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set number of columns to start looking at&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;If&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;( (&lt;/FONT&gt;&lt;FONT color="#0000dd" face="Consolas" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;( dt1_new, i ) &amp;lt;&amp;lt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Get Name&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;) != &lt;/FONT&gt;&lt;FONT color="#800080" face="Consolas" size="2"&gt;"4C4QC30.0.Cv"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;dt1_new &amp;lt;&amp;lt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Delete Column&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 15 Dec 2018 05:32:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Delete-Columns-Not-Containing-a-Certain-Word/m-p/85894#M38363</guid>
      <dc:creator>ShahirahLoqman</dc:creator>
      <dc:date>2018-12-15T05:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Delete Columns Not Containing a Certain Word</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Delete-Columns-Not-Containing-a-Certain-Word/m-p/85907#M38374</link>
      <description>&lt;P&gt;Here are the minor changes to your code to make it work.&amp;nbsp; Note the looping going from the last column to your 11th column.&amp;nbsp; That allows for using the column number for deleting.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1_new = Current Data Table();

For( i = N Cols( dt1_new ), i &amp;gt;= 11, i--, // set number of columns to start looking at
	If( Contains( Column( dt1_new, i ) &amp;lt;&amp;lt; Get Name, "4C4QC30.0.Cv" ) == 0,
		dt1_new &amp;lt;&amp;lt; Delete Columns( i )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Dec 2018 18:29:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Delete-Columns-Not-Containing-a-Certain-Word/m-p/85907#M38374</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-12-15T18:29:07Z</dc:date>
    </item>
  </channel>
</rss>

