cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

What is criteria of column placement when sorting columns by data type?

I have table of 172 columns in a specific order that are a mix of character and nominal data types. Using the window on the left side of the table, I sort the columns by type which occurs ok. However, within each type grouping, the columns are no longer in a specific order but seem to have been placed randomly. What is the criteria for the column placements when the sort is done?

4 REPLIES 4
jthi
Super User

Re: What is criteria of column placement when sorting columns by data type?

According to 

Using JMP > Enter and Edit Your Data > Organize Data in Data Tables > Rearrange Columns in Data Tab... 

Reorder By Data Type

Arranges the columns from left to right in alphabetic order by data type (expression, row state, character, or numeric).

So I would guess the columns are moved to data type groups (character, expression, numeric, row state) and stay then they stay in original order within those groups.

-Jarmo
RP_64
Level I

Re: What is criteria of column placement when sorting columns by data type?

Sadly, I don't want them arranged alphabetically which is the way JMP appears to want to arrange them, requiring more work at my end.. They are from survey and I want them kept in order seen. 

Re: What is criteria of column placement when sorting columns by data type?

You might impose the order you want with a prefix to the column name, such as an index value (01, 02, etc.). The ordered sorted by JMP would then be the same as the order by desired you.

mmarchandFSLR
Level VI

Re: What is criteria of column placement when sorting columns by data type?

Here's a function that I believe does what you want.  Tested with JMP 19.04.  It breaks without the Eval( Eval Expr()).

arrange_columns = Function( {dt},
	num_columns = dt << Get Column Names( Numeric, String );
	char_columns = dt << Get Column Names( Character, String );
	ex_columns = dt << Get Column Names( Expression, String );
	rs_columns = dt << Get Column Names( RowState, String );
	dt << Reorder By Data Type();
	For Each( {group, index}, {num_columns, char_columns, ex_columns, rs_columns},
		If( N Items( group ) > 1,
			Eval( Eval Expr( dt << Move Selected Columns( Expr( group[2 :: N Items( group )] ), After( group[1] ) ) ) )
		)
	);
);

Recommended Articles