cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
ENTHU
Level IV

select where on multiple columns

I have a data table with 60 columns and I'm trying to select columns which have "Test" in their name.I then need to select all 1.values that lie in the range 50 & -50 in Test_AB;

2.values that lie in the range 100 & -100 in Test_CD;

3.values that lie in the range 200 & -200 in Test_EF;

 

and delete other rows.

Is there an easy way to do this in JSL?

 

Thanks

3 REPLIES 3
txnelson
Super User

Re: select where on multiple columns

Below is an example of how to do the items you request

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// Find all columns that have PN in their name, and select the column
For( i = 1, i <= N Cols( dt ), i++,
	If( Contains( Column( dt, i ) << get name, "PN" ),
		Column( dt, i ) << set selected
	)
);

// Select the required rows
dt << select where(
	118 <= :NPN1 <= 122 | 
	360 <= :PNP1 <= 300 | 
	500 <= :PNP2 <= 510
);

// Delete the non selected rows
dt << invert row selection;
dt << delete rows;

These 2 tasks are very elementry items in JSL.  With the number of interactions you have had on the Discussion Forum, I would have expected you to have been able to handle your issue without help from the Discussion Group.  If you are still having issues with writing your own JSL, then I strongly suggest that you sign up for a training class  on JSL, and even more strongly suggest you take the time to read the Scripting Guide.

Jim
ENTHU
Level IV

Re: select where on multiple columns

Thanks for the response.
Well, with my knowledge through all the interactions in this forum I already had written this piece of code before posting.The intent behind asking this question was to see if there is an "easy" way to do this.By that I mean lesser number of lines.Also if there is a way to avoid loops.I have multiple loops in the script and that slows down the execution.
txnelson
Super User

Re: select where on multiple columns

If you already had working code it might be very useful to include it in your request.  Many times a modification of your working code will the best thing to achieve your results.

Jim