Hello, I'm new to the JMP Script, and I searched a lot in the forum, but didn't get a answer for my question.
Basically I did a for loop and each will generate a new table. I want to rename the column BBB to XXX(i), such as column XXX(1) for the first new table, column XXX(2) for the second new table, XXX(3) for the third new table ... column XXX(10) for the last one and then merge all the new tables, so that there will be only one big table with columns XXX(1), XXX(2)...XXX(10)
Here is my script:
For( i = 1, i <= 10, i++,
dt << Summary(
Group( :AAA), N( :BBB ), Freq( "None" ), Weight( "None" )
);
:N (BBB) << Set Name (XXX(i));
);
);
But I couldn't get I want.
Could you guys help me? I appreciate any suggestion.
There are a couple of issues with your code
- The column name created in the Summary Platform is "N( BBB )". When you reapply it into a JMP statement, JMP interprets it as a function, N() with an argument of "BBB". To fix this, use the :Name() function.
- The argument for << Set Name() needs to be a character string.
See the script below for the corrections
For( i = 1, i <= 10, i++,
dtSum = dt << Summary(
Group( :AAA ),
N( :BBB ),
Freq( "None" ),
Weight( "None" )
);
:Name( "N( BBB )" ) << Set Name( "XXX(" || Char( i ) || ")" );
);