JSL how to rename column name by expressionHi,
I have a list of of columns name that generated by Summary statistic. I want to remove all the prefix and sufix that only keep the part that i want. how do i do this in JSL?
Columns
% of Total(UP9019-01) => UP9019-01
% of Total(UP9019-02) => UP9019-02
% of Total(UP9019-03) => UP9019-03
.....
ScriptingRe: JSL how to rename column name by expressionThe first way I would handle this, is to have the Summary Platform name the output column as the same as the input column name. This is done by specifying
statistics column name format( "column" )
This is selectable from the Summary Platform Input Dialog Box
If you can not do this, then all that has to be done is to reset the column name using this JSL
:Name("% of Total(UP9010-01)") << set name( "UP9019-01: );
If this needs to be automated and not hard coded, and this column is the first column in the data table, it could be handled with this JSL
column(1) << set name(word(2,column(1)<<GET name=""></GET>
Re: JSL how to rename column name by expressionHere is a simple example using the "statistics column name format( "column" )" option, showing the % of Total columns named their original column name

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
Data Table( "big class" ) << Summary(
Group( :age ),
Name( "% of Total" )(:height),
Name( "% of Total" )(:weight),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);Re: JSL how to rename column name by expressionHi Nelson,
Thanks for the tips. 1st option that specifying statics column name format ("column") does not work. It still carry the % of Total in the table.
JSL option that you suggest work perfectly!
ColList = dt_source << get column names( string );
//% of Total(UP9019-01)
For( i = 4, i <= N Items( ColList ), i++,
Column( i ) << set name( Word( 2, Column( i ) << get name, "()" ) )
);Re: JSL how to rename column name by expressionHi Nelson,
Statistic column name will work if you didn't use subgroup. In my case, i need to use subgroup. % of Total will still attached to the subgroup