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
madhu
Level III

How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

Hi

Is there any method in JMP Pro that can arrange the column names in alphabetical order (ascending and descending)?

I have named the variables by acronyms only (see examples below).

ACCMLAMEBIs both the insured driver [you] and other driver jointly to blame for this incident? Yes/No 2
ACCMLAMEBRIf Yes/No, why? Give justification [in texts] between 50 and 100 words 3

 

DAMVICSIDEDamage to vehicle/Point of impact [front/back/driver side/passenger side]
DASHCAMFDid you have any dash cam fitted in your car during the accident? [Yes/No]
DASHCAMOPWas the dashcam in full operation during the accident? [Yes/No]

 

LCLAIMYWhat is the largest claim did you file in past with any insurer since you started driving? [in £ amount]
LICCATCategory of driving license
LICYRNumber of years of driving license held
LINECHFREFrequency of Lane Changes per Trip
LOCINCCLocation of the incident [Country]
LOCINCDLocation of the incident [district name]
LOCINCS

Location of the incident [street name]

Currently, I can see the acronyms (abbreviations) of the variable definitions but not in order (see the attached screenshot). This takes me to time to locate the variable on the that I want to include in the model. 

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII

Re: How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

you can reorder the columns "by name" via the Cols menu:

hogi_0-1731599791655.png

 

View solution in original post

5 REPLIES 5
hogi
Level XII

Re: How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

you can reorder the columns "by name" via the Cols menu:

hogi_0-1731599791655.png

 

txnelson
Super User

Re: How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

@hogi provides a way to interactively sort the columns into an ascending order.  Here is a little script that will sort in either direction.  It is currently set to sort them in a descending(reverse) order.  Just remove the Reverse() function and the order will be ascending.

Names Default To Here( 1 );

dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNameList = dt << get column names( string );

colNameList = Reverse( Sort List( colNameList ) );

dt << move selected columns( colNameList );

 It should also be noted that when using a selection box for any of the JMP Platforms, such as Distribution, Fit Y by X, etc. the column list in the dialog box allows for the ascending and descending ordering of the column names for selection

txnelson_0-1731604519464.png

 

Jim
madhu
Level III

Re: How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

Dear @txnelson 

Thank you for the solution. However, I am not familiar wit the script. How can I use the script you suggested?

Regards

M

 

madhu
Level III

Re: How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

Dear @hogi 

This works. Thank you for your support.

KR

M

txnelson
Super User

Re: How can I arrange column names in JMP file in alphabetical order (ascending and descending)?

The example that I provided will open a sample data table called Semiconductor Capability, which happens to have something like 132 column.  It will then reorder the columns in a descending alphabetical order.  You will be able to observe the end result by clicking on the window for the data table.

 

To actually run the script, all you need to do, is to cut an paste the script from my response to a script window. And then run the script.  To do this just

Go to

     File=>New=>JSL Script

Right Click on the first line on the script and then select Paste

The script will be displayed in the script window.

Then to run the script, either click on the Icon with the green Run JSL triangle  in the JSL tool bar at the top of the JMP window or Right Click anywhere on the script and select Run Script.

 

A very minor change to the script can set it up so that when ever it is run, it will do the reodering for whatever data table is the current active data table.

Names Default To Here( 1 );
dt = Current Data Table();
colNameList = dt << get column names( string );
colNameList = Reverse( Sort List( colNameList ) );
dt << move selected columns( colNameList );

If you want, this script can be added as a new tool on the tool bar that will set it up to run whenever the tool is clicked on.  You can read up on how to do that under the JMP Help

Jim