Is there an easy way to collapse whitespace in all the columns using JMP Scripting?
Hello, just in case you are asking about performing a Collapse Whitespace function on every character column to remove excess whitespaces there is a script below. I am sure there are many ways to do this but I just stole some code from the advanced log after manually recoding a column. Wasn't sure exactly what you were asking for so thought I would provide this just in case.
Names Default to Here(1); dt = Current Data Table(); Cols = dt << Get Column Names( Character, String); For( i = 1, i <= N Items( Cols ), i++, Eval( Eval Expr( dt << Begin Data Update; dt << Recode Column( Expr( Column( dt, Cols[i] ) ), {Collapse Whitespace( _rcNow )}, Update Properties( 1 ), Target Column( Column( dt, Expr( Cols[i] ) ) ) ) ) ); dt << End Data Update; )
Try sending the message <<Optimize Display, as shown in the Scripting Index
<<Optimize Display
If you want to do this interactively,
This is exactly what I'm looking for, but it didn't work for me. I got the error message below when I tried the script.
I tweaked it, and it now works. Thank you!
@dn610 You may not be using JMP 16. I have noticed that when using the Recode script, in version 16 that line for Update Properties gets added. If you just delete that line for update properties the code should still work for earlier versions.
I'm using JMP 15, and that's exactly what I did to make it work. Thanks again!