cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

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

Merge Rows of Text Data

Hi, 

 

I have an Excel file with Text Data in it. The format of the data in the Excel file looks something like this: 

Screenshot 2021-08-03 154447.png

I want to merge the text in the Document Body Col in a single cell based on the Document Title. For example, instead of having two rows for File Name 1, I want one row for File Name 1 with the Document body concatenated together. This is not possible in Excel due to the character limit being exceed. Is there a way to perform this task in JMP Pro?

 

Thanks,

-N

NV
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Merge Rows of Text Data

Using Query could work:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(5),
	Compress File When Saved(1),
	New Column("Title", Character, "Nominal", Set Values({"A", "A", "B", "B", "B"})),
	New Column("Body", Character, "Nominal", Set Values({"A", "B", "C", "D", "E"}))
);

Query(Table(dt, "dt1"), "Select title, GROUP_CONCAT(body, ' ') FROM dt1 group by title");

SQL Functions Available for JMP Queries 

 

You might also be able to do this with some split/stack/combine columns combination.

 

Edit: Using Transpose:

jthi_3-1628022413589.png

Result table:

jthi_4-1628022424419.png

Use Combine Columns with Row 1 - Row 3 selected:

jthi_5-1628022466770.png

Result:

jthi_6-1628022492015.png

Delete unnecessary columns:

jthi_7-1628022506271.png

 

 

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Merge Rows of Text Data

Using Query could work:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(5),
	Compress File When Saved(1),
	New Column("Title", Character, "Nominal", Set Values({"A", "A", "B", "B", "B"})),
	New Column("Body", Character, "Nominal", Set Values({"A", "B", "C", "D", "E"}))
);

Query(Table(dt, "dt1"), "Select title, GROUP_CONCAT(body, ' ') FROM dt1 group by title");

SQL Functions Available for JMP Queries 

 

You might also be able to do this with some split/stack/combine columns combination.

 

Edit: Using Transpose:

jthi_3-1628022413589.png

Result table:

jthi_4-1628022424419.png

Use Combine Columns with Row 1 - Row 3 selected:

jthi_5-1628022466770.png

Result:

jthi_6-1628022492015.png

Delete unnecessary columns:

jthi_7-1628022506271.png

 

 

 

-Jarmo
NVarz
Level II

Re: Merge Rows of Text Data

Hi J! Thank you so much! That worked. Appreciate your help :)

NV

Recommended Articles