Hello @AlphaLion662,
Is this what you were looking for? Keep in mind, I don't know how you want to modify the column names, so I just added prefixes. You can see the prefixes in the variables first, second, and third. The column renaming happens in the block under the note "Col name change here
".
Names default to here(1);
clear log();
dt = open( "$SAMPLE_DATA/Arrhythmia.jmp" );
// Gets all column names in a list
allcols = dt << Get column names();
// Stores the number of columns
numcols = N Items( allcols );
// Some modifier to column names
first = "Tree";
second = "Car";
third = "Star";
For( i = 1, i <= numcols, i++,
// Temporarly stores the column name for later usage
temp = column( dt, allcols[i] ) << Get Name;
if(
// First col, then every 3rd col thereafter
i == 1 | Modulo( i - 1, 3 ) == 0,
// Col name change here
col_Name1 = column(dt,i) << Get Name;
newname1 = first || "_" || col_Name1;
eval( column(allcols[i] ) ) << Set Name( newname1 ),
// Second col, then every 3rd col thereafter
i == 2 | Modulo( i - 2, 3 ) == 0, //( i - 2 ) % 3
// Col name change here
col_Name2 = column(dt,i) << Get Name;
newname2 = second || "_" || col_Name2;
eval( column(allcols[i] ) ) << Set Name( newname2 ),
// Third col, then every 3rd col thereafter
i == 3 | Modulo( i - 3, 3 ) == 0,
// Col name change here
col_Name3 = column(dt,i) << Get Name;
newname3 = third || "_" || col_Name3;
eval( column(allcols[i] ) ) << Set Name( newname3 ),
);
);
Learning every day!