I would like to recode (by JSL) a column using the 'Split On' advanced option 'Split Delimiter'= (Text)...
Did you perform the task manually to verify the results are what you want? If so, did you save the results in a new data column with a formula? If so, then examine the formula to see how it might be done in a script.
Hi, Mark
Yes but the result is a match formula
I would like, if possible, to script the recoding, using recode options
something like
dt_:var_name << recode(split delimiter text("String"))....
I don't know if that's possible.
My suggestion is similar to @Mark_Bailey. But rather than saving the column's formula, you can manually create the recode, but before actually completing the recode, you can go to the red triangle, and select
Script==>Save to Script Window
and it will show you the script necessary to generate the recode you have specified
Current Data Table() << Begin Data Update; dc1 = New Column( :weight ); dc1 << Set Name( "weight 2 2" ); Current Data Table() << Go to( dc1 ); Current Data Table() << Move Selected Columns( after( :weight ) ); For Each Row( dc1[] = Match( :weight, 64, 60, 67, 60, 74, 70, 79, 70, 81, 80, 84, 80, 85, 80, 91, 90, 92, 90, 93, 90, 95, 90, 98, 90, 99, 90, 104, 100, 105, 100, 106, 100, 107, 100, 111, 110, 112, 110, 113, 110, 115, 110, 116, 110, 119, 110, 123, 120, 128, 120, 134, 130, 142, 140, 145, 140, 172, 170, :weight ) ); Current Data Table() << End Data Update;
Thank you but I'ld to avoid the match scripting because this recoding will be implemented within a global script and the text delimiter could be changed by my user depending on the column to be recoded.
That's why i'ld prefer, if possible, to write the recoding function using options...
Right, so you know it works. Now, copy that formula and paste it over the 'recode expression' in this script to accomplish the same thing.
Current Data Table() << New Column( "Recoded", Formula( recode expression ) );
Thank you all
This problem is solved...