cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Jaz
Jaz
Level IV

Merging Rows

Hi, 

 

I was just wondering if there was away to merge two rows from the same data table using JSL? I was contemplating using the Join function but I'm not entirely sure how that will work. 

 

Thanks. 

15 REPLIES 15
chessknt87
Level I

Re: Merging Rows

Thank you for your reply. The problem is that I want it to create new column labels since the data in the table has nothing to split by. If I group by subject and ask it to split value and date what do I pick for split by? I want each observation to just be listed under a new column created for a duplicate observation

 

Subject   Value Date               Subject Value Date  Value2 Date2 value3  date3

A              1          x                     A           1        x          2         y       .            .

A               2          y      ---->        B           3       z          4         g     5           f

B              3           z

B               4          g

B               5          f

txnelson
Super User

Re: Merging Rows

Create a new column that gives a sequence number for each of your subjects

if(row()==1,counter-1);
If(lag(:subject) != :subject, counter=1, counter=counter+1);
counter;

Then you can split by the new column

Jim

Re: Merging Rows

Hi! I've got a similar problem. I'd like to merge rows with the same time value without creating new columns. So in the example below rows 75629 and 75630 would become one row with more data in it and 75631/2 would move up one number. Is there a way to do something like this?

 

Capture.JPG

Jeff_Perkinson
Community Manager Community Manager

Re: Merging Rows

If it's a matter of dealing with the missing values for those columns you might try using Tables->Summary to group by your datetime column and use the Max statististic for all those columns.

 

JMPScreenSnapz323.png

 

 

-Jeff
plfazeli
Level II

Re: Merging Rows

You mentioned this in a post a few years ago "I've had data sets where there were multiple rows that needed to be "combined" into a single observation.  How to do it depended on whether I wanted the average or sum (or....) of those rows."

 

Can you tell me how to do this? (I would want a sum of the value in a variable for unique subject IDs with multiple rows of data)

txnelson
Super User

Re: Merging Rows

Use the Summary platform
Tables=>Summary
Jim