cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
plfazeli
Level II

Merging Rows with Sum

Help!  I have a datatset with 200ish rows.  There are 170ish unique IDs, meaning multiple people have multiple rows.  Is there a way to merge the data from the applicable rows (e.g., some rows are dates so that would not be applicable) with a sum?  Such that each unique subject ID only has ONE row in the dataset.  If its only possible to this with a dataset with applicable rows (i.e., all numeric/continuous variables), I could subset my data to just subject ID + the needed rows for summing.  Does this make sense?  

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Merging Rows with Sum

OK....here is a display of a data table that has 200 rows, with 118 different IDs and contains a date and an Expense column.  

merge1.PNG

What I want is a data table with just one entry per ID and for the date to be the last date the person had a transaction, and I want to know the sum of the expenses.  So I go to 

     Tables=>Summary

and it brings up the following Dialog window which I fill in the information to group by IDs, return the Maximum Date value and the Sum of the Expenses

merge2.PNG

I then click on the OK button and it creates a data table with the summary statistics

merge3.PNG

I could have also gotten the same results by using the Tabulate Platform

     Analyze=>Tabulate

It is a drag and drop report writer, that once you have the report the way you want, you can go to the red triangle and request that a data table be made from the report

merge4.PNG

Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: Merging Rows with Sum

I assume this is the same question you subsequently added to a previous discussion topic. The answer is to use the Summary platform
Tables=>Summary
Jim
plfazeli
Level II

Re: Merging Rows with Sum

Thanks.  Can you elaborate?

txnelson
Super User

Re: Merging Rows with Sum

OK....here is a display of a data table that has 200 rows, with 118 different IDs and contains a date and an Expense column.  

merge1.PNG

What I want is a data table with just one entry per ID and for the date to be the last date the person had a transaction, and I want to know the sum of the expenses.  So I go to 

     Tables=>Summary

and it brings up the following Dialog window which I fill in the information to group by IDs, return the Maximum Date value and the Sum of the Expenses

merge2.PNG

I then click on the OK button and it creates a data table with the summary statistics

merge3.PNG

I could have also gotten the same results by using the Tabulate Platform

     Analyze=>Tabulate

It is a drag and drop report writer, that once you have the report the way you want, you can go to the red triangle and request that a data table be made from the report

merge4.PNG

Jim
plfazeli
Level II

Re: Merging Rows with Sum

That was INCREDIBLY helpful.  Thanks so much!

txnelson
Super User

Re: Merging Rows with Sum

Now you need to go to
Help=>JMP Documentation Library
and read both the Discovering JMP and the Using JMP documents!!!
It will make your time with JMP far more enjoyable.
Jim
ATenB89
Level I

Re: Merging Rows with Sum

Follow on question: 

How would you graph this as a bar chart with IDs on the x-axis and the Sum on the y-axis, without any spaces in the graph? 

 

I am finding this challenging on a similar problem, the graph comes out with a uniformly spaced numbers on the x-axis, but there is a gap for ID8 for example because there is no data, I want to squish the bars together when there is no data for that number. 

 

Thank you for your help! 

ATenB89
Level I

Re: Merging Rows with Sum

Never mind! I figured out my problem. I needed to change the ID data type from continuous to ordinal.