cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Deleting columns that are not in a list

Hi Guys,

I have a set of columns that I want to keep and then delete all except this set.

The columns that I want to delete are large in number.

Is there any easy way to do this using a script?

Thanks.
10 REPLIES 10
Von_Andre
Level II

Re: Deleting columns that are not in a list

Hi Dave, Appreciate all the help. Nice blog by the way! I have a very large data set consisting >8000 columns and I have some columns to keep and some don't. I ended up by using subset on the first columns that I want to keep. After which I run a loop on the rest of the table for keeping columns that matches from my keywords like "_M". Then finally join the subset and the table I had kept with column names matching my criteria. It works fine now. However, I then again try to use list on below code but seems not running. Is using of list not allowed on this? dt = Current Data Table(); // select data table dt << Set Name( "Raw_Data" ); dt << Subset( Columns( 1 :: 30 ), Rows( all ), Output Table( "Subset" ) ); // keep main column names dt << Revert(); //Keep vt columns colList = Data Table( "Raw_Data" ) << Get Column Names( String ); For( i = N Cols( dt ), i >= 1, i--, If( !Contains( colList[i], "_M" ), //Keep only columns with "_M"" in the name dt << Delete Column( Column( colList[i] ) ) ) );

Recommended Articles