<?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: Select columns from a data table based on rows from another data table. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822229#M100173</link>
    <description>&lt;P&gt;shampton82 thanks, script is great altogether.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2024 15:50:32 GMT</pubDate>
    <dc:creator>SpannerHead</dc:creator>
    <dc:date>2024-12-12T15:50:32Z</dc:date>
    <item>
      <title>Select columns from a data table based on rows from another data table.</title>
      <link>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822011#M100133</link>
      <description>&lt;P&gt;I have 2 data tables and I want to use one to create a subset from the other.&amp;nbsp; One table has a series of columns and the filter table has those column names of interest listed as cells (rows) on another table.&amp;nbsp; I tried to use nested loops to get the subset but I get persistent errors.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 20:00:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822011#M100133</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-12-11T20:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select columns from a data table based on rows from another data table.</title>
      <link>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822033#M100135</link>
      <description>&lt;P&gt;Can you provide example tables and an example of what you wish to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt2 = New Table("Untitled",
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Set Values({"age", "sex"}))
);

cols = dt2[0, 1];

dt_subset = dt &amp;lt;&amp;lt; Subset(All rows, columns(Eval(cols)));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1733947934280.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71045i9C54D893FB4AC477/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1733947934280.png" alt="jthi_0-1733947934280.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 20:12:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822033#M100135</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-11T20:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select columns from a data table based on rows from another data table.</title>
      <link>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822053#M100140</link>
      <description>&lt;P&gt;Oh, try this!&amp;nbsp; I had the same need I believe:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

nw=newwindow("Select tables and column",show menu(0),
				Hlistbox(
					Panelbox("Data Table to select columns",
						lb1=listbox(get data table list ())
					),
					Panelbox("data table to select rows",
						vlistbox(
								lb2=listbox(get data table list ()),
								clb1=collistbox(),
								button box("press to get columns", dtname2=lb2 &amp;lt;&amp;lt; Get Selected; names = datatable(dtname2[1]) &amp;lt;&amp;lt; Get Column names; clb1 &amp;lt;&amp;lt; append (names);),
								button box("press to select columns",col=clb1 &amp;lt;&amp;lt; Get Selected; colist=column(datatable(dtname2[1]),col)&amp;lt;&amp;lt; GetValues(Format());
																	dtname1=lb1 &amp;lt;&amp;lt; Get Selected; 
																	colqty=datatable(dtname1[1])&amp;lt;&amp;lt;get column names("string");
																	for(i=1, i&amp;lt;= nitems(colqty),i++,
																			for(j=1, j&amp;lt;=n items(colist),j++,
																				print(colqty[i],colist[j]);
																				if(colqty[i]==colist[j],
																						column(datatable(dtname1[1]),colist[j])&amp;lt;&amp;lt; Set Selected( 1 );
																						j=1;
																						break();
																					
																				);
																			
																			);
																		
																	);
																	
															
							
										)
						)
						
					)
				)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Dec 2024 21:04:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822053#M100140</guid>
      <dc:creator>shampton82</dc:creator>
      <dc:date>2024-12-11T21:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select columns from a data table based on rows from another data table.</title>
      <link>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822229#M100173</link>
      <description>&lt;P&gt;shampton82 thanks, script is great altogether.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 15:50:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-columns-from-a-data-table-based-on-rows-from-another-data/m-p/822229#M100173</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-12-12T15:50:32Z</dc:date>
    </item>
  </channel>
</rss>

