cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Script

hcarr01
Level VI
Hello everyone,
 
Here is my database:
 
undefined

 

 
I would like to be able to delete all the columns (from the 4th to the last column).
I am using the following script but it is not working properly.
 
dt22 = current data table();max = N cols(dt22);
For (i=4 , i <= max , i++,
 dt22 << delete columns(i);
);
Thank you for your answers !

This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User


Re: Script

Easiest is most likely to use list of columns to remove with Delete Columns

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

col_names = dt << Get Column Names("String");
Remove From(col_names, 1, 4);
wait(2); // for demo purposes
dt << Delete Columns(col_names);

If you want to use For loop, loop from the end to avoid issues with indices changing.

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User


Re: Script

Easiest is most likely to use list of columns to remove with Delete Columns

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

col_names = dt << Get Column Names("String");
Remove From(col_names, 1, 4);
wait(2); // for demo purposes
dt << Delete Columns(col_names);

If you want to use For loop, loop from the end to avoid issues with indices changing.

-Jarmo