<?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: Associate Columns By Name in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848784#M102430</link>
    <description>&lt;P&gt;Do the pairs always exist? Are there other columns in the table than these pairs? Are they in specific order?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Can most likely be made much better depending on the real use case&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = New Table("",
	New Column("VT123ABCH"),
	New Column("VT123ABCL")
);

collist = dt &amp;lt;&amp;lt; get column names(string);

hcols = Filter Each({colname}, colList,
	Ends With(colname, "H");
);

aa = Associative Array();

For Each({hcolname}, hcols,
	lcolname = Left(hcolname, Length(hcolname) - 1) || "L";
	If(dt &amp;lt;&amp;lt; Has Column(lcolname),
		aa[hcolname] = lcolname
	);
);

Show(aa);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Mar 2025 15:04:24 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-03-20T15:04:24Z</dc:date>
    <item>
      <title>Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848773#M102428</link>
      <description>&lt;P&gt;I got something to work here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Automatically-plot-associated-columns/m-p/755653#M93775" target="_blank"&gt;Solved: Automatically plot associated columns - JMP User Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but I'm pretty sure it's unnecessarily cumbersome.&amp;nbsp; I have column names ending with the letter H (High) that I need to associate with column names that otherwise match but end with the letter L (Low).&amp;nbsp; I can create an associative array with the column names having the final character removed.&amp;nbsp; Snookered as to what to do next?&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 = Current Data Table();

colList = dt &amp;lt;&amp;lt; get column names( string );

for each({col,index}, colList,
	//colList[index] = substr(col,1,3)
	colList[index] = Left(col,Length(col)-1)
);

grps = associative array(colList)&amp;lt;&amp;lt;get keys;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For instance, VT123ABCH needs to plot against VT123ABCL and so forth.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 14:42:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848773#M102428</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-03-20T14:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848784#M102430</link>
      <description>&lt;P&gt;Do the pairs always exist? Are there other columns in the table than these pairs? Are they in specific order?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Can most likely be made much better depending on the real use case&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = New Table("",
	New Column("VT123ABCH"),
	New Column("VT123ABCL")
);

collist = dt &amp;lt;&amp;lt; get column names(string);

hcols = Filter Each({colname}, colList,
	Ends With(colname, "H");
);

aa = Associative Array();

For Each({hcolname}, hcols,
	lcolname = Left(hcolname, Length(hcolname) - 1) || "L";
	If(dt &amp;lt;&amp;lt; Has Column(lcolname),
		aa[hcolname] = lcolname
	);
);

Show(aa);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2025 15:04:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848784#M102430</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-20T15:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848786#M102431</link>
      <description>&lt;P&gt;Here is an example of how you might do what you want&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1742483201466.png" style="width: 630px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74044i144ACD6B4F71CF0E/image-dimensions/630x364?v=v2" width="630" height="364" role="button" title="txnelson_0-1742483201466.png" alt="txnelson_0-1742483201466.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNames = dt &amp;lt;&amp;lt; get column names( continuous, string );

For Each( {col}, colNames,
	If( Ends With( col, "1" ) &amp;amp; Contains( colNames, Substr( col, 1, Length( col ) - 1 ) || "2" ),
		Graph Builder(
			Size( 534, 456 ),
			Show Control Panel( 0 ),
			Variables( X( As Column( col ) ), Y( As Column( Substr( col, 1, Length( col ) - 1 ) || "2" ) ) ),
			Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
		);
	
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2025 15:07:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848786#M102431</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-03-20T15:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848876#M102447</link>
      <description>&lt;P&gt;Jarmo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks much tidier that what I had, however, I'm getting this error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Object 'Data Table' does not recognize the message 'Has Column'"&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 19:58:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848876#M102447</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-03-20T19:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848882#M102448</link>
      <description>&lt;P&gt;That was added in JMP18&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1742500969200.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74054iC96968C8F5F7F17B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1742500969200.png" alt="jthi_0-1742500969200.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can change it to Contains() and it should be fine most of the time&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Contains(collist, lcolname)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2025 20:03:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848882#M102448</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-20T20:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848889#M102449</link>
      <description>&lt;P&gt;Jarmo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is close but I notice that&amp;nbsp;hcolname is empty, whereas lcolname has a value.&amp;nbsp; Do I need to establish hcolname as an object or list?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 20:33:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848889#M102449</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-03-20T20:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848890#M102450</link>
      <description>&lt;P&gt;hcols should contain a list of all columns which end with "H". This is then used in For Each and each if the items will be one by one used as hcolname. You can add debug prints to understand what is going on. Also, this definitely isn't the only way of doing this you could for example easily in a single loop.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 20:46:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848890#M102450</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-20T20:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848892#M102451</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jarmo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gets me a little closer but the lcolname does not populate until the final value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each({hcolname, index}, hcols,
	{lcolname, index}, hcols = Left(hcolname, Length(hcolname) - 1) || "L";
	If(dt &amp;lt;&amp;lt; Contains(collist, lcolname),
		aa[hcolname] = lcolname
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2025 21:23:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848892#M102451</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-03-20T21:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848895#M102453</link>
      <description>&lt;P&gt;For me it seems to be working fine. You can change the example table to semiconductor capability and check for some numbers at the end&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

collist = dt &amp;lt;&amp;lt; get column names(string);

hcols = Filter Each({colname}, colList,
	Ends With(colname, "1");
);

aa = Associative Array();

For Each({hcolname}, hcols,
	lcolname = Left(hcolname, Length(hcolname) - 1) || "2";
	If(dt &amp;lt;&amp;lt; Has Column(lcolname),
		aa[hcolname] = lcolname
	);
);

Show(aa);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aa = ["ESM1" =&amp;gt; "ESM2", "FST1" =&amp;gt; "FST2", "INM1" =&amp;gt; "INM2", "IVP1" =&amp;gt; "IVP2", "NPN1" =&amp;gt; "NPN2", "PBA1" =&amp;gt; "PBA2", "PLG1" =&amp;gt; "PLG2", "PLY1" =&amp;gt; "PLY2", "PNP1" =&amp;gt; "PNP2", "RES1" =&amp;gt; "RES2", "RSP1" =&amp;gt; "RSP2", "SIT1" =&amp;gt; "SIT2", "VDP1" =&amp;gt; "VDP2", "VPM1" =&amp;gt; "VPM2"];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could also go a bit different route with a bit more configuration options&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

endchar1 = "1";
endchar2 = "2";

rgx_endchar1 = Eval Insert("(.+?)^endchar1^$");

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");


collist = dt &amp;lt;&amp;lt; get column names(string);

aa = Associative Array();
For Each({colname}, collist,
	col_ptrn = Regex(colname, rgx_endchar1, "\1");
	If(!IsMissing(col_ptrn), // ends with H
		If(Contains(collist, col_ptrn || endchar2),
			aa[col_ptrn || endchar1] = col_ptrn || endchar2;
		);
	);
);

show(aa);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Both of these do return same results for me&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 21:40:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848895#M102453</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-20T21:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848897#M102454</link>
      <description>&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great script and a lot simpler.&amp;nbsp; I tweaked it a bit to have all the plots in a "Compilation"&amp;nbsp;&lt;SPAN&gt;window .&lt;/SPAN&gt;&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 = Current Data Table();
colNames = dt &amp;lt;&amp;lt; get column names( continuous, string );
New Window( "Compilation",
	For Each( {col}, colNames,
		If(
			Starts With( col, "VT" ) &amp;amp; Contains(
				colNames,
				Substr( col, 1, Length( col ) - 1 ) || "H"
			),
			Graph Builder(
				Size( 534, 456 ),
				Show Control Panel( 0 ),
				Variables(
					X( As Column( col ) ),
					Y( As Column( Substr( col, 1, Length( col ) - 1 ) || "L" ) )
				),
				Wrap( :LOT ),
				Elements(
					Points( X, Y, Legend( 1 ) ),
					Line Of Fit( X, Y, Legend( 3 ) )
				)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Mar 2025 21:46:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848897#M102454</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-03-20T21:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Associate Columns By Name</title>
      <link>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848899#M102455</link>
      <description>&lt;P&gt;Jarmo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oddness of JMP.&amp;nbsp; First one doesn't work, second one does, JMP 17 maybe?&amp;nbsp; Thanks for putting up with me.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2025 22:07:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Associate-Columns-By-Name/m-p/848899#M102455</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-03-20T22:07:03Z</dc:date>
    </item>
  </channel>
</rss>

