<?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 In a data frame Filter column based on another column that contains the column name in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/826686#M100788</link>
    <description>&lt;P&gt;Hello Folks,&lt;/P&gt;&lt;P&gt;I have attached a data set. In the data set, I have column called Parameter that contains the name of the columns that are in the data set. I want to first filter the column that corresponds to each unique column name that is present in the Parameter column and then join it to the subset column that I have created and create a variability chart. At this moment I have 2 unique parameters in the Parameter column and this can vary week on week, so I would like it to be parameterized.&amp;nbsp; I have below some of the code that I have done. Any help would be appreciated&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pio&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;dt_2 = Data Table( "jmp_question_T_V0" ) &amp;lt;&amp;lt; Summary(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Group( :Parameter ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Freq( "None" ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Weight( "None" )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;lst = column(dt_2,1) &amp;lt;&amp;lt; GetAsMatrix();&lt;/DIV&gt;&lt;DIV&gt;close(dt_2,no save);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;subset_cols = {:Name("PRA"), :Name("WA"), :Name("CH"), :Name("WA_D"),&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;:Name("CH_D"),:Name("SL_T"),:Name("TST_DATE"),:Name("IL_M"),:Name("QTY"),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;:Name("W"),:Name("Parameter"),:Name("h_t_d")};&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;length (lst)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;iparam = 1&lt;/DIV&gt;&lt;DIV&gt;while(iparam=length(lst)) {&lt;/DIV&gt;&lt;DIV&gt;print(lst[iparam])&lt;/DIV&gt;&lt;DIV&gt;dt=dt_1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dt_1 &amp;lt;&amp;lt; select where (:Parameter == lst[iparam])&amp;nbsp; //works&lt;/DIV&gt;&lt;DIV&gt;dt&amp;lt;&amp;lt;subset(output table) //works&lt;/DIV&gt;&lt;DIV&gt;dt&amp;lt;&amp;lt; subset(all rows, columns(subset_cols))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dt_param&amp;lt;&amp;lt;Subset((dt_1 &amp;lt;&amp;lt; select where (:Parameter == lst[iparam])), columns(subset_cols))&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jan 2025 15:00:11 GMT</pubDate>
    <dc:creator>PioJesudoss</dc:creator>
    <dc:date>2025-01-10T15:00:11Z</dc:date>
    <item>
      <title>In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/826686#M100788</link>
      <description>&lt;P&gt;Hello Folks,&lt;/P&gt;&lt;P&gt;I have attached a data set. In the data set, I have column called Parameter that contains the name of the columns that are in the data set. I want to first filter the column that corresponds to each unique column name that is present in the Parameter column and then join it to the subset column that I have created and create a variability chart. At this moment I have 2 unique parameters in the Parameter column and this can vary week on week, so I would like it to be parameterized.&amp;nbsp; I have below some of the code that I have done. Any help would be appreciated&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pio&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;dt_2 = Data Table( "jmp_question_T_V0" ) &amp;lt;&amp;lt; Summary(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Group( :Parameter ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Freq( "None" ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Weight( "None" )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;lst = column(dt_2,1) &amp;lt;&amp;lt; GetAsMatrix();&lt;/DIV&gt;&lt;DIV&gt;close(dt_2,no save);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;subset_cols = {:Name("PRA"), :Name("WA"), :Name("CH"), :Name("WA_D"),&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;:Name("CH_D"),:Name("SL_T"),:Name("TST_DATE"),:Name("IL_M"),:Name("QTY"),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;:Name("W"),:Name("Parameter"),:Name("h_t_d")};&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;length (lst)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;iparam = 1&lt;/DIV&gt;&lt;DIV&gt;while(iparam=length(lst)) {&lt;/DIV&gt;&lt;DIV&gt;print(lst[iparam])&lt;/DIV&gt;&lt;DIV&gt;dt=dt_1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dt_1 &amp;lt;&amp;lt; select where (:Parameter == lst[iparam])&amp;nbsp; //works&lt;/DIV&gt;&lt;DIV&gt;dt&amp;lt;&amp;lt;subset(output table) //works&lt;/DIV&gt;&lt;DIV&gt;dt&amp;lt;&amp;lt; subset(all rows, columns(subset_cols))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dt_param&amp;lt;&amp;lt;Subset((dt_1 &amp;lt;&amp;lt; select where (:Parameter == lst[iparam])), columns(subset_cols))&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 15:00:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/826686#M100788</guid>
      <dc:creator>PioJesudoss</dc:creator>
      <dc:date>2025-01-10T15:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/826699#M100789</link>
      <description>&lt;P&gt;The script you have provided doesn't work as it is missing ; and using incorrect syntax for while loop. If you want to get unique values from a character column, you can use Summary table, Summarize function or Associative Array. I'm not exactly sure what you wish to do as you only provided single .csv file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

params = Associative Array(Column(dt, "Parameter")) &amp;lt;&amp;lt; get keys;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you wish to create separate subsets based on the Parameter column, you can just use that as a subset by column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1736522129795.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71809i3883D13CB4AB5244/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1736522129795.png" alt="jthi_0-1736522129795.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

mycols = {"W", "W_s", "R_rd1", "R_rd1_s"};

dt_subsets = dt &amp;lt;&amp;lt; Subset(By(:Parameter), Selected Rows(0), Columns(mycols));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or looping&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

params = Associative Array(Column(dt, "Parameter")) &amp;lt;&amp;lt; get keys;
mycols = {"W", "W_s", "R_rd1", "R_rd1_s"};

dts = {};

For Each({param}, params,
	cur_rows = dt &amp;lt;&amp;lt; get rows where(:Parameter == param);
	dt_subset = dt &amp;lt;&amp;lt; Subset(Rows(cur_rows), Selected Rows(0), Columns(mycols));
	Insert Into(dts, dt_subset);
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also select the rows but it is usually unnecessary&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 15:19:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/826699#M100789</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-10T15:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827288#M100884</link>
      <description>&lt;P&gt;Hi Jthi,&lt;/P&gt;&lt;P&gt;Thanks for your reply but what I want is this. I mean, If Parameter has&amp;nbsp;S_rd2_iqr, then I want only the column&amp;nbsp;S_rd2_iqr to be filtered as shown in the screen shot.&amp;nbsp;If Parameter has S_rd2, then I want only the column S_rd2 to be filtered as shown in the screen shot. These parameters will vary each time so I want them to be parameterized&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="PioJesudoss_0-1736848916373.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71921i1B9133294BCCC107/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PioJesudoss_0-1736848916373.png" alt="PioJesudoss_0-1736848916373.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 10:04:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827288#M100884</guid>
      <dc:creator>PioJesudoss</dc:creator>
      <dc:date>2025-01-14T10:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827290#M100885</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

params = Associative Array(Column(dt, "Parameter")) &amp;lt;&amp;lt; get keys;

dts = {};

For Each({param}, params,
	cols_to_subset = {"Parameter"};
	Insert Into(cols_to_subset, param);
	cur_rows = dt &amp;lt;&amp;lt; get rows where(:Parameter == param);
	dt_subset = dt &amp;lt;&amp;lt; Subset(Rows(cur_rows), Selected Rows(0), Columns(cols_to_subset), Output Table("Parameter="||param));
	Insert Into(dts, dt_subset);
);&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-1736850380881.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71922i694577B16F38A76A/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_0-1736850380881.png" alt="jthi_0-1736850380881.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 10:26:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827290#M100885</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-14T10:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827331#M100890</link>
      <description>&lt;P&gt;Thanks Jarmo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just starting jmp scripting and I need variablity chart as past of the for loop for each data table to save the image&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dts={};

For Each({param}, params,
	//cols_to_subset = {"Parameter"};
	cols_to_subset = {:Name("PRODUCT"), :Name("WAFER_LOT"), :Name("CHUNK"), :Name("WAFER_ID"),
	:Name("CHUNK_ID"),:Name("SLIDER_LOT"),:Name("TST_DATE"),:Name("WAFER_LOT"),:Name("FAIL_MODES"),:Name("DISPOSITION"),:Name("QTY_HGA"),
:Name("min_ET_date"),:Name("wafer_type"),:Name("wd_wafer_mfr_loc"),:Name("cq_or_child"),:Name("radius"),:Name("calc_sh_rd1"),
:Name("calc_sh_rd2"),:Name("CTQ_WRT_WDTH"),:Name("Parameter"),:Name("Product_waferID_Chunk_ID"),:Name("hga_tester_id")};
	Insert Into(cols_to_subset, param);
	//Insert Into(param,cols_to_subset);
	cur_rows = dt_tester &amp;lt;&amp;lt; get rows where(:Parameter == param);
	dt_subset = dt_tester &amp;lt;&amp;lt; Subset(Rows(cur_rows), Selected Rows(0), Columns(cols_to_subset) ,Output Table("Parameter="||param));
	//Insert Into(dts, dt_subset);
	//);
	
	
	//this part not working
	dt_subset &amp;lt;&amp;lt; Variability Chart(
	Y(__params__),
	X( :WAFER_LOT, :CHUNK, :hga_tester_id ),
	Sigma Multiplier( 6 ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Variability Analysis( Std Dev Chart( 0 ) ),
	SendToReport(
		Dispatch(
			{__Variability Chart__},
			"Variability Chart",
			FrameBox,
			{Row Legend(
				hga_tester_id,
				Color( 1 ),
				Color Theme( "JMP Default"(1) ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2025 14:39:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827331#M100890</guid>
      <dc:creator>PioJesudoss</dc:creator>
      <dc:date>2025-01-14T14:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827332#M100891</link>
      <description>&lt;P&gt;Thanks Jarmo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But require to plot variability chart as part of the for loop to save the graph&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;params = Associative Array(Column(dt, "Parameter")) &amp;lt;&amp;lt; get keys;
dts = {};


For Each({param}, params,
	//cols_to_subset = {"Parameter"};
	cols_to_subset = {:Name("PRA"), :Name("WA"), :Name("CH"), :Name("WA_D"),
	:Name("CH_D"),:Name("SL_T"),:Name("TST_DATE"),:Name("IL_M"),:Name("QTY"),
:Name("W"),:Name("Parameter"),:Name("h_t_d")};
	Insert Into(cols_to_subset, param);
	cur_rows = dt &amp;lt;&amp;lt; get rows where(:Parameter == param);
	dt_subset = dt &amp;lt;&amp;lt; Subset(Rows(cur_rows), Selected Rows(0), Columns(cols_to_subset), Output Table("Parameter="||param));
	Insert Into(dts, dt_subset);

	
	Variability Chart(
	Y(__params__ ),
	X( :WA, :CH, :h_t_d ),
	Sigma Multiplier( 6 ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Variability Analysis(__params__, Std Dev Chart( 0 ) ),
	SendToReport(
		Dispatch(
			{},
			"Variability Chart",
			FrameBox,
			{Row Legend(
				h_t_d,
				Color( 1 ),
				Color Theme( "JMP Default"(1) ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
)
	Pause()
	
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2025 14:42:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827332#M100891</guid>
      <dc:creator>PioJesudoss</dc:creator>
      <dc:date>2025-01-14T14:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: In a data frame Filter column based on another column that contains the column name</title>
      <link>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827336#M100895</link>
      <description>&lt;P&gt;Are the variability plots the end goals you wish to have? Or do you need the subsets also for something else (you can most likely just create those variability plots from your original table with some scripting without creating the subsets)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which columns should be used as Y and X for the variability charts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 15:51:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/In-a-data-frame-Filter-column-based-on-another-column-that/m-p/827336#M100895</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-14T15:51:29Z</dc:date>
    </item>
  </channel>
</rss>

