Choose Language Hide Translation Bar
Highlighted
jasongao
Level II

rearrange table by script

I am new to the script.

I have a table like this:

Last nameFrist nameItemsValue
WayneBruceAge35
WayneBruceHeight180
WayneAliceAge23
WayneAliceHeight172
PakerJohnAge19
PakerPeterAge25
PakerJohnHeight185
PakerPeterHeight178

 

And would like to convert it to this format: 

 

Last nameFrist nameAgeHeight
WayneBruce35180
WayneAlice23172
PakerJohn19185
PakerPeter25178

 

I can successfully do this by using jmp subset-> rename column name -> update (with matching column) from table menu. Could someone help for the script, if assuming the data set has uncertain number of people and uncertain number of items?

Thanks a lot!

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Thierry_S
Level VI

Re: rearrange table by script

It may not be exactly what you are looking for but have you tried the Split Table feature? It is much faster than the rather convoluted method you described.
Here is how to use it: 1) split column: Value; 2) Split by: Items; 3) Grouping: First Name; Keep All Columns
Thierry R. Sornasse

View solution in original post

Highlighted
txnelson
Super User

Re: rearrange table by script

This is a simple table Split
Tables==>Split
Use Item as the Split By column,
Value as the Split Columns
and Last Name and First Name as the Group columns.
Run it interactively, and then go to the output table and edit the source entry and you will see the script to use to implement it in JSL
Jim

View solution in original post

Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: rearrange table by script

Tables -> Split will do exactly what you're looking for.

 

JMPScreenSnapz011.png

 

After putting your columns in the dialog and clicking OK. You'll find a Source script in the resulting data table.

 

JMPScreenSnapz012.png

Right click on the Source script and choose Edit to see the script to reproduce the split.

JMPScreenSnapz013.png

-Jeff

View solution in original post

4 REPLIES 4
Highlighted
Thierry_S
Level VI

Re: rearrange table by script

It may not be exactly what you are looking for but have you tried the Split Table feature? It is much faster than the rather convoluted method you described.
Here is how to use it: 1) split column: Value; 2) Split by: Items; 3) Grouping: First Name; Keep All Columns
Thierry R. Sornasse

View solution in original post

Highlighted
txnelson
Super User

Re: rearrange table by script

This is a simple table Split
Tables==>Split
Use Item as the Split By column,
Value as the Split Columns
and Last Name and First Name as the Group columns.
Run it interactively, and then go to the output table and edit the source entry and you will see the script to use to implement it in JSL
Jim

View solution in original post

Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: rearrange table by script

Tables -> Split will do exactly what you're looking for.

 

JMPScreenSnapz011.png

 

After putting your columns in the dialog and clicking OK. You'll find a Source script in the resulting data table.

 

JMPScreenSnapz012.png

Right click on the Source script and choose Edit to see the script to reproduce the split.

JMPScreenSnapz013.png

-Jeff

View solution in original post

Highlighted
jasongao
Level II

Re: rearrange table by script

Thank you all!
Article Labels

    There are no labels assigned to this post.