cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use JMP Live to centralize and share reports within groups. Webinar with Q&A April 4, 2pm ET.
Choose Language Hide Translation Bar
View Original Published Thread

Searching Column name

Jackie_
Level VI

Hi,

I need to search the column names which has the string "fo" in it and select those column in the Y,Columns.

How do I include this in JSL?

Any help on this would be very much appreciated

 

Jacksmith12_0-1630594330995.png

 

Thanks,

Jack

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User


Re: Searching Column name

It is a new feature in JMP16.

 

You will have to use For loop to get the same result in JMP15.

Something like this:

filteredCols = {};
For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "SS"), Insert Into(filteredCols, colList[i]))
);
-Jarmo

View solution in original post

jthi
Super User


Re: Searching Column name

I think Scripting Index can get you quite close:

jthi_1-1630602177314.png

 

I wouldn't generally suggest deleting rows in JMP, hiding and Excluding is usually better option.

-Jarmo

View solution in original post

7 REPLIES 7
jthi
Super User


Re: Searching Column name

Here is an example where all columns containing SS are added to dialog:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
colList = dt << Get Column Names("String");
a = Filter Each({value}, colList, Contains(value, "SS"));
obj = dt << Explore Outliers(Y(Eval(a)));
obj << Relaunch Analysis;
obj << Close Window();
-Jarmo
Jackie_
Level VI


Re: Searching Column name

Many Thanks @jthi 

 

I am not sure if JMP 15 supports Filter Each command. I tried the script and it's giving me an error

Jacksmith12_0-1630596171133.png

 

jthi
Super User


Re: Searching Column name

It is a new feature in JMP16.

 

You will have to use For loop to get the same result in JMP15.

Something like this:

filteredCols = {};
For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "SS"), Insert Into(filteredCols, colList[i]))
);
-Jarmo
Jackie_
Level VI


Re: Searching Column name

I want to select and delete those particular rows. How can I include in the jsl script?

Jacksmith12_0-1630598761184.png

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
colList = dt << Get Column Names("String");


filteredCols = {};
For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "SS"), Insert Into(filteredCols, colList[i]))
);

dt << Explore Outliers(Y(Eval(filteredCols)),

Show only columns with outliers( 1 )
,Quantile Range Ouliers

	
);
jthi
Super User


Re: Searching Column name

I think Scripting Index can get you quite close:

jthi_1-1630602177314.png

 

I wouldn't generally suggest deleting rows in JMP, hiding and Excluding is usually better option.

-Jarmo
Jackie_
Level VI


Re: Searching Column name

Happy Wednesday @jthi ,

I was attempting to add another contain statement to filter all the columns containing the string "SE" but it didn't seem to work as expected.

I added Contains(colList[i], "SE") in the if loop Any thoughts?

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
colList = dt << Get Column Names("String");


filteredCols = {};
For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "SS"), 
	Contains(colList[i], "SE"),
	
	Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
	Y((Eval(filteredCols) )));
obj << Tail Quantile( 0.1 );
obj << Quantile Range Outliers;
obj<< Select Rows(All);

Thanks,

Jack

txnelson
Super User


Re: Searching Column name

This needs to be an OR clause

If(Contains(colList[i], "SS") |
	Contains(colList[i], "SE"),
	Insert Into(filteredCols, colList[i])
);
Jim