<?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: Deleting columns that are not in a list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39265#M22961</link>
    <description>Thanks! Is it possible to subset columns that matches within my criteria?&lt;BR /&gt;I'm interested to subset only columns containing keywords. And not the full column names only (since I have a lot of data).</description>
    <pubDate>Tue, 16 May 2017 01:21:12 GMT</pubDate>
    <dc:creator>Von_Andre</dc:creator>
    <dc:date>2017-05-16T01:21:12Z</dc:date>
    <item>
      <title>Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2296#M2296</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;I have a set of columns that I want to keep and then delete all except this set.&lt;BR /&gt;&lt;BR /&gt;The columns that I want to delete are large in number. &lt;BR /&gt;&lt;BR /&gt;Is there any easy way to do this using a script? &lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 18 Aug 2010 21:12:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2296#M2296</guid>
      <dc:creator />
      <dc:date>2010-08-18T21:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2297#M2297</link>
      <description>Loop through all columns to create a list of those Columns you wish to delete, by comparing each column with your list of keepers.&lt;BR /&gt;&lt;BR /&gt;Example&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Aug 2010 12:57:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2297#M2297</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2010-08-19T12:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2298#M2298</link>
      <description>Thanks, that worked. I wish you could use two lists and subtract/ex or one from the other.</description>
      <pubDate>Thu, 19 Aug 2010 16:49:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2298#M2298</guid>
      <dc:creator />
      <dc:date>2010-08-19T16:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2299#M2299</link>
      <description>That might work if you have only numeric items (L-values). However that's rarely the case with column names. Maybe you could switch between names and numbers by using associative arrays in a clever way.</description>
      <pubDate>Thu, 19 Aug 2010 19:00:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/2299#M2299</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2010-08-19T19:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39168#M22898</link>
      <description>Hello. I was browsing this discussion. Found the subject very helpful for me but I cannot see the solution. Must have been deleted or something? Appreciate if you can post it back. Thanks!</description>
      <pubDate>Fri, 12 May 2017 01:21:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39168#M22898</guid>
      <dc:creator>Von_Andre</dc:creator>
      <dc:date>2017-05-12T01:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39182#M22905</link>
      <description>&lt;P&gt;Slightly different bu the same idea, the following code deletes columns that &lt;U&gt;are&lt;/U&gt; in a list. &amp;nbsp;Specifically you have a list of columns (&lt;STRONG&gt;all&lt;/STRONG&gt;), and items are removed if they are contained in the list &lt;STRONG&gt;excl&lt;/STRONG&gt;.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;all = dt &amp;lt;&amp;lt; Get Column Names(string);
// assume excl is a list of column names that i want to remove
For (i=1,i&amp;lt;=NItems(excl),i++,
	pos = Contains(all,excl[i]);
	If (pos&amp;gt;0,
		RemoveFrom(all,pos)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2017 09:35:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39182#M22905</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2017-05-12T09:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39233#M22939</link>
      <description>Hi Dave, Appreciate your quick response on my query. I did your sample code but I seems the columns on my list still appear in my table. Is there something I missed? dt = Data Table( "temp" ); all = dt &amp;lt;&amp;lt; Get Column Names( string ); vt = {"lot_id", "wf_id", "die_x"}; For( i = 1, i &amp;lt;= N Items( vt ), i++, pos = Contains( all, vt[i] ); If( pos &amp;gt; 0, Remove From( all, pos ) ); );</description>
      <pubDate>Mon, 15 May 2017 01:41:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39233#M22939</guid>
      <dc:creator>Von_Andre</dc:creator>
      <dc:date>2017-05-15T01:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39252#M22953</link>
      <description>&lt;P&gt;"There's a million ways to get things done..." &amp;nbsp;Talking Heads, "What A Day That Was", 1984&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the number of columns to be deleted is truly large, it might be more efficient to Subset the table with all rows, keeping only the columns in your list. &amp;nbsp;That could save lots of iterative deletion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your application might not be that easy, though.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2017 18:06:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39252#M22953</guid>
      <dc:creator>Kevin_Anderson</dc:creator>
      <dc:date>2017-05-15T18:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39256#M22956</link>
      <description>&lt;P&gt;Sorry, maybe I misuunderstood. &amp;nbsp;The code removes items from the list not from the table. &amp;nbsp;But the updated list can be used with a Subset command to generate a subset table only with the columns you are interested in.&lt;/P&gt;
&lt;P&gt;More here:&amp;nbsp;&lt;A href="http://www.pega-analytics.co.uk/blog/scripting-table-subsets/" target="_blank"&gt;http://www.pega-analytics.co.uk/blog/scripting-table-subsets/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2017 20:54:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39256#M22956</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2017-05-15T20:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39263#M22959</link>
      <description>Hi Dave, Appreciate all the help. Nice blog by the way! I have a very large data set consisting &amp;gt;8000 columns and I have some columns to keep and some don't. I ended up by using subset on the first columns that I want to keep. After which I run a loop on the rest of the table for keeping columns that matches from my keywords like "_M". Then finally join the subset and the table I had kept with column names matching my criteria. It works fine now. However, I then again try to use list on below code but seems not running. Is using of list not allowed on this? dt = Current Data Table(); // select data table dt &amp;lt;&amp;lt; Set Name( "Raw_Data" ); dt &amp;lt;&amp;lt; Subset( Columns( 1 :: 30 ), Rows( all ), Output Table( "Subset" ) ); // keep main column names dt &amp;lt;&amp;lt; Revert(); //Keep vt columns colList = Data Table( "Raw_Data" ) &amp;lt;&amp;lt; Get Column Names( String ); For( i = N Cols( dt ), i &amp;gt;= 1, i--, If( !Contains( colList[i], "_M" ), //Keep only columns with "_M"" in the name dt &amp;lt;&amp;lt; Delete Column( Column( colList[i] ) ) ) );</description>
      <pubDate>Tue, 16 May 2017 01:11:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39263#M22959</guid>
      <dc:creator>Von_Andre</dc:creator>
      <dc:date>2017-05-16T01:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting columns that are not in a list</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39265#M22961</link>
      <description>Thanks! Is it possible to subset columns that matches within my criteria?&lt;BR /&gt;I'm interested to subset only columns containing keywords. And not the full column names only (since I have a lot of data).</description>
      <pubDate>Tue, 16 May 2017 01:21:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-columns-that-are-not-in-a-list/m-p/39265#M22961</guid>
      <dc:creator>Von_Andre</dc:creator>
      <dc:date>2017-05-16T01:21:12Z</dc:date>
    </item>
  </channel>
</rss>

