cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • Use JMP Clinical with CDISC-compliant data. Review studies, ID safety and efficacy signals & communicate findings with interactive graphics. Register to see how. Aug. 27, 2 pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

Delete specific columns

I'm trying to delete columns based on specific data in those columns. For example, if the column contains the value RA, TV, EW, or EH  I want to delete it. I've worked with the code below and no errors appear in the log, but no columns are deleted either. Thanks for any help.

dt = current data table();

for(i = 1, i<=NCol(dt), i++,

if (Column(i)== "RA" , dt<< delete columns(column(i)),

     if(Column(i) == "TV", dt << delete columns(column(i)),

  if(Column(i) == "EW", dt<< delete columns(column(i)),

    if(Column(i) == "EH", dt << delete columns(column(i))

    )))));

I've also tried this

dt = current data table();

for(i = 1, i<=NCol(dt), i++,

for each row(if (Column(i)== "RA" , dt<< delete columns(column(i)),

     if(Column(i) == "TV", dt << delete columns(column(i)),

  if(Column(i) == "EW", dt<< delete columns(column(i)),

    if(Column(i) == "High Dose", dt << delete columns(column(i))

    )))));

);

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Delete specific columns

Here's one way:

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Delete columns based on contents . . .

Wait(2);

for(c = NCols(dt), c>=1, c--,

colVals = Column(c) << getValues;

if(Contains(colVals, "KATIE"), dt << deleteColumn(c));

);

View solution in original post

2 REPLIES 2
ian_jmp
Level X

Re: Delete specific columns

Here's one way:

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Delete columns based on contents . . .

Wait(2);

for(c = NCols(dt), c>=1, c--,

colVals = Column(c) << getValues;

if(Contains(colVals, "KATIE"), dt << deleteColumn(c));

);

Re: Delete specific columns

Works great. Thanks Ian!

Recommended Articles