Subscribe Bookmark RSS Feed

JMP formula to transfer format

hupin

Community Trekker

Joined:

Aug 11, 2013

Dear Expert,

I have some package data as show in col_1, but would be like to use JMP formula to transfer to the format as show on Col_2 and Col3. Can anyone advise which formula should I use? Thanks

Hu Pin

Package ( extraction )

Desired Format 1

Desired Format 2

P-BGA-416-10

BGA416

BGA-416

P-BGA-416-4

BGA416

BGA-416

PG-BGA-416-22

BGA416

BGA-416

PG-BGA-416-4

BGA416

BGA-416

PG-DIP-14-2

DIP14

DIP-14

PG-DSO-20-2

DSO20

DSO-20

PG-LQFP-144-23

LQFP144

LQFP-144

PG-LQFP-144-4

LQFP144

LQFP-144

PG-MQFP-80-7

MQFP80

MQFP-80

PG-OLQFN-76-3

OLQFN76

OLQFN-76

PG-TSSOP-28-1

TSSOP28

TSSOP-28

PG-TSSOP-28-16

TSSOP28

TSSOP-28

PG-TSSOP-28-2

TSSOP28

TSSOP-28

PG-WQFN-6-2

WQFN6

WQFN-6

 

4 REPLIES
ms

Super User

Joined:

Jun 23, 2011

One way is to use regular expressions.

s="P-BGA-416-10";

regex(s, "-(\w+)-(\d+)-","\1\2");

regex(s, "-(\w+)-(\d+)-","\1-\2");

The first formula should produce "Desired Format 1" and the second "Desired Format 2". Replace s with the source column if using in a column formula.

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

And, for those like me who still can't wrap their heads around regular expressions, the Word() function works well. In fact, it's the function I recommend most.

Word( 2, :Name( "Package ( extraction )" ), "-" ) || Word( 3, :Name( "Package ( extraction )" ), "-" )

Word( 2, :Name( "Package ( extraction )" ), "-" ) || "-" ||  Word( 3, :Name( "Package ( extraction )" ), "-" )

The top one will give you Desired Format 1 and the bottom is Desired Format 2.

-Jeff

-Jeff
kevin_c_anderso

Community Trekker

Joined:

Jun 5, 2014

I once read where Regular Expressions are "write only"...often, an author can't read the RegEx they wrote a short time ago!   

billw_jmp

Staff

Joined:

Jul 2, 2014

Hi Hu Pin,

One other thought for you if you are using JMP 12.  Use the JMP Recode tool under Columns.  The new recode functionality allows you to group changes, and you can set up multiple recodes in the same recode dialogue.  You can then save the changes as a new column or as a formula column.  You can also save the recode as a script and use it again as new data comes in or transfer it to a new data table as needed.

Best,

Bill