cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
sbidwe
Level II

Use match or contains ?

Hi  

Request some help with scripting the "Output" column.

I have a list of Sr IDs allocated to different events and need the resulting output column where LAB T0 event is matched to specific Event

Screen Shot 2021-04-19 at 6.04.08 PM.png

Would be obliged for the help. I have attached the excel file for the above screenshot. 

Thanks 

S

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Use match or contains ?

Given a data table that looks like this

out1.PNG

JMP provided the following script as I interactively when through the steps to create your required output

// Clear row selection
Data Table( "Example File" ) << Clear Select;


// Data table summary
// → Data Table( "Subset of Untitled 9 By (Sr ID, Event)" )
Data Table( "Example File" ) << Summary(
	Group( :Sr ID, :Event ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);

// Select matching cells
Data Table( "Example File By (Sr ID, Event)" ) <<
Select Where( :Event == "LAB_T0" );


// Delete selected rows
Data Table( "Example File By (Sr ID, Event)" ) <<
Select Where( :Event == "LAB_T0" ) << Delete Rows;


// Delete column: N Rows
Data Table( "Example File By (Sr ID, Event)" ) << Delete Columns( :N Rows );


// Change column name: Event → Output
Data Table( "Example File By (Sr ID, Event)" ):Event << Set Name( "Output" );


// Update data tables
Data Table( "Example File" ) << Update(
	With( Data Table( "Example File By (Sr ID, Event)" ) ),
	Match Columns( :Sr ID = :Sr ID )
);

out2.PNG

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Use match or contains ?

Given a data table that looks like this

out1.PNG

JMP provided the following script as I interactively when through the steps to create your required output

// Clear row selection
Data Table( "Example File" ) << Clear Select;


// Data table summary
// → Data Table( "Subset of Untitled 9 By (Sr ID, Event)" )
Data Table( "Example File" ) << Summary(
	Group( :Sr ID, :Event ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);

// Select matching cells
Data Table( "Example File By (Sr ID, Event)" ) <<
Select Where( :Event == "LAB_T0" );


// Delete selected rows
Data Table( "Example File By (Sr ID, Event)" ) <<
Select Where( :Event == "LAB_T0" ) << Delete Rows;


// Delete column: N Rows
Data Table( "Example File By (Sr ID, Event)" ) << Delete Columns( :N Rows );


// Change column name: Event → Output
Data Table( "Example File By (Sr ID, Event)" ):Event << Set Name( "Output" );


// Update data tables
Data Table( "Example File" ) << Update(
	With( Data Table( "Example File By (Sr ID, Event)" ) ),
	Match Columns( :Sr ID = :Sr ID )
);

out2.PNG

Jim
sbidwe
Level II

Re: Use match or contains ?

Thanks much Jim