cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
SpannerHead
Level VI

Associate Columns By Name

I got something to work here

 

Solved: Automatically plot associated columns - JMP User Community

 

but I'm pretty sure it's unnecessarily cumbersome.  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).  I can create an associative array with the column names having the final character removed.  Snookered as to what to do next?

 

names default to here(1);
dt = Current Data Table();

colList = dt << 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)<<get keys;

For instance, VT123ABCH needs to plot against VT123ABCL and so forth.


Slán



SpannerHead
10 REPLIES 10
SpannerHead
Level VI

Re: Associate Columns By Name

Jim

 

Great script and a lot simpler.  I tweaked it a bit to have all the plots in a "Compilation" window .

 

Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( continuous, string );
New Window( "Compilation",
	For Each( {col}, colNames,
		If(
			Starts With( col, "VT" ) & 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 ) )
				)
			)
		)
	)
);

Slán



SpannerHead

Recommended Articles