cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
lwx228
Level VIII

Or how to implement this simple substitution with JSL?

For example, remove the "S" from all names in the "name" column of "Big class.jMP ".

 

2020-06-18_18-44.png

Can do it directly by substitution?Can the new VERSION of JMP be implemented?
get looks like the "rename" column.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User (Alumni)

Re: Or how to implement this simple substitution with JSL?

You can create a column formula to perform the substitution:  Substitute(:name,"S","")

In code it would look something like this:

dt = Current Data Table();
dt = New Column( "New Name",
		Character,
		"Nominal",
		Formula( Substitute( :name, "S", "" ) )
);

 

 

 
 

 

 

-Dave

View solution in original post

5 REPLIES 5
David_Burnham
Super User (Alumni)

Re: Or how to implement this simple substitution with JSL?

You can create a column formula to perform the substitution:  Substitute(:name,"S","")

In code it would look something like this:

dt = Current Data Table();
dt = New Column( "New Name",
		Character,
		"Nominal",
		Formula( Substitute( :name, "S", "" ) )
);

 

 

 
 

 

 

-Dave
lwx228
Level VIII

Re: Or how to implement this simple substitution with JSL?

Thank Dave!

Formula( Substitute
lala
Level VII

Re: Or how to implement this simple substitution with JSL?

How do you use JSL to perform the replacement operation to achieve this manual effect?


Replace column 2, "5" with null in a perfectly matched fashion, and "15" or "25" in this column are unaffected.

 

Thanks!

2020-06-24_14-59.png

Re: Or how to implement this simple substitution with JSL?

Numeric data should not pose a problem. See this example:

 

Names Default to Here( 1 );

dt = New Table( "Substitution",
	New Column( "Old Data", Numeric, Continuous ),
	New Column( "New Data", Numeric, Continuous )
);

:Old Data << Set Values( J( 50, 1, Random Integer( 3, 18 ) ) );

Wait( 2 );

For Each Row(
	:New Data = Substitute( :Old Data, 5, . );
);
lala
Level VII

Re: Or how to implement this simple substitution with JSL?

Good way, thank you!