Is there a simple way to split a column containing 500-character long string into 500 columns, one char per column?
I am using JMP17.
Here is a little different approach to the problem. It uses some built in JMP functions that might prove to be faster than @Jackie_ approach.
Names Default To Here( 1 ); dt = Current Data Table(); // Create a new column that has a delimiter between each character dt << New Column( "Char", character, set each value( x = Words( As Column( 1 ), "" ); Concat Items( x, "`" ); ) ); // Use Text to Columns to create the new columns and populate them dt << text to columns( columns( char ), delimiters( "`" ) ); // Cleanup the table dt << delete columns( char );
All the answers you got so far were good. but there is another non scripting option.
yet, the text to cols add in works just finehttps://community.jmp.com/t5/JMP-Add-Ins/Text-to-Columns-Version-3/ta-p/21621just leave the delimiter empty and it will split each letter into a new column with just 3 clicks.
for some reason, using the built in text to columns from the cols >> utilities >> text to columns... will not work without a separator
Try something like this
dt = Current Data Table(); dt << Begin data update; For( j = 1, j <= N Rows( dt ), j++, For( i = 1, i <= 500, i++, //you might want to use length of the string than 500 dt << New Column( Word( i, Column( dt, 1 )[j], "" ) ) ) ); dt << End data update;
I am new to scripting. Is there a way to specify which column to perform this split char?
RIght now I delete all the other columns and only leave the one column that contains the long string. IT worked wonderfully.
My JMP is not responding when I try your scripts. IT probably because that my table is large. I guess it will work for a smaller table.
never mind. I only need to put that column as the 1st column in a table. Thank you very much for your help
In the JSL I provided, the column to use to separate into multiple columns is referenced as
As Column( 1 )
This specifies for the Words() function to use the first column in the data table to do the separation of characters on. The numeric value can be changed to point to whatever column number one wants. The column number can also be changed to the actual column name.
as column( "the column name" )
Thank you so much. This is so easy to use. wonderful trick to know!