cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Flatten a table

FlorenceJMP
Level I

Good morning,

Is it possible in JMP to join several columns in 1 single line from an identifier, in other words: go from the first table to the second?

THANKS

NAMEFirst nameitem 1item 2item 3item 4
frzegfzehe didA12224a
he didhe didB35b
he didhe didC467c
GRZGRxcsqD55d
GZEGFEZE231e
GZEGFEZF72f
GZEQDG80g
NAMEFirst nameitem 1-1item 2-1item 3-1item 4-1item 1-2item 2-2item 3-2item 4-2item 1-3item 2-3item 3-3item 4-3
frzegfzehe didA12224a
he didhe didB35bC467c
GRZGRxcsqD55d
GZEGFEZE231eF72fG80g
GZEQDG80g

This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .

2 REPLIES 2
hogi
Level XII


Re: Aplatir une table

in the second table, "G" shows up twice. with GFEZ and QD?

hogi
Level XII


Re: Aplatir une table

You could stack and then split the data.
To stack the columns, they have to have the same format. So maybe some additional step are necessary to align the formats and set them back to the original format.

 

dt = New Table( "demo",
	Add Rows( 7 ),
	Compress File When Saved( 1 ),
	New Column( "NAME",
		Character,
		Set Values( {"frzegfze", "he did", "he did", "GRZGR", "GZE", "GZE", "GZE"} )
	),
	New Column( "First name",
		Character,
		Set Values( {"he did", "he did", "he did", "xcsq", "GFEZ", "GFEZ", "QD"} )
	),
	New Column( "item 1",
		Character,
		Set Values( {"A", "B", "C", "D", "E", "F", "G"} )
	),
	New Column( "item 2",
		Character,
		Set Values( {"12", "3", "4", "5", "2", "7", "8"} )
	),
	New Column( "item 3",
		Character,
		Set Values( {"224", "5", "67", "5", "31", "2", "0"} )
	),
	New Column( "item 4",
		Character,
		Set Values( {"a", "b", "c", "d", "e", "f", "g"} )
	)
);

dt << New Column( "entry",
	Formula( Col Rank( Row(), :NAME, :First name ) ),
);

dtstacked = dt << Stack(
	columns( :item 1, :item 2, :item 3, :item 4 )
);


dtsplit = dtstacked <<
Split(
	Split By( :entry, :Label ),
	Split( :Data ),
	Group( :NAME, :First name )
);