cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to design an experiment, explore factor-response relationships, assess tradeoffs, and ID best settings. Register for Sep. 11 Mastering JMP.

Discussions

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

How do I write a script to recode to remove partial text?

I am trying to write a script that converts any occurrence where a number is within the text "saturated ()", to remove the saturated (), leaving only the number.  I thought I could edit a recode script, but had no success.  Thank you in advance.

 

Names Default To Here( 1 );
dt = Data Table( "Book1_Sheet1" );
dt << Begin Data Update;
dt << Recode Column(
    dt:Area,
    {Map Value(
        _rcOrig,
        {"saturated( ######### )", "#########"},
        Unmatched( _rcNow )
    )},
    Update Properties( 1 ),
    Target Column( :Area )
);
dt << End Data Update;
2 REPLIES 2

Re: How do I write a script to recode to remove partial text?

Try this. I tried to write the regular expression to recognize any correctly formatted number and ignore blanks or incorrectly formatted numbers.

 

Names Default To Here( 1 );
dt = Data Table( "Book1_Sheet1" );
dt << Begin Data Update;
dt << Recode Column(
	dt:Area,
	{Regex(
		_rcNow,
		"^saturated\((\-*)([\d\.]+)([eE]*)(\-*)(\d*)\)",
		"\1\2\3\4\5",
		GLOBALREPLACE
	)},
	Update Properties( 1 ),
	Target Column( :Area )
);
dt << End Data Update;

 

 

txnelson
Super User

Re: How do I write a script to recode to remove partial text?

Here is one way to change the values

Names Default To Here( 1 );
dt = Data Table( "Book1_Sheet1" );

For Each Row(
	If( Left( :Area, 10 ) == "saturated(",
		:Area == Word( 2, :Area, "()" )
	)
);
Jim

Recommended Articles