cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-546421%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EFor%20%E3%83%AB%E3%83%BC%E3%83%97%20--%20%E3%83%AA%E3%82%B9%E3%83%88%E5%86%85%E3%81%AE%E8%A1%8C%E3%81%A8%E6%95%B0%E5%BC%8F%E3%82%92%E5%89%8A%E9%99%A4%E3%81%97%E3%81%BE%E3%81%99%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-546421%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%80%81%E3%81%BF%E3%82%93%E3%81%AA%E3%80%81%3C%2FP%3E%3CP%3E%E3%83%AA%E3%82%B9%E3%83%88%E5%86%85%E3%81%AEfor%E3%83%AB%E3%83%BC%E3%83%97%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%89%8A%E9%99%A4%E5%BC%8F%E3%82%92%E7%B9%B0%E3%82%8A%E8%BF%94%E3%81%97%E3%81%A6%E3%81%8B%E3%82%89%E5%88%97%E3%82%92%E5%89%8A%E9%99%A4%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F%3C%2FP%3E%3CP%3E%E3%81%93%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E3%82%82%E3%81%AE%EF%BC%9A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecol_formula%20%3D%20%7B%22%E5%88%97%201%22%2C%20%22%E5%88%97%202%22%20%7D%3B%3C%2FP%3E%3CP%3Ecol2_row%20%3D%20%7B%22Column3%22%2C%20%22Column4%22%7D%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor(%20i%20%3D%201%2C%20i%20%26lt%3B%3D%20N%20%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%20(%20col_formula%20)%2C%20i%2B%2B%2C%3CBR%20%2F%3E%20col_formula%20(i)%20%26lt%3B%26lt%3B%20%E6%95%B0%E5%BC%8F%E3%82%92%E5%89%8A%E9%99%A4%20%2F%2F%E6%95%B0%E5%BC%8F%E3%82%92%E5%89%8A%E9%99%A4%3C%2FP%3E%3CP%3Ecol2_row%20(i)%20%26lt%3B%26lt%3B%20%E8%A1%8C%E3%82%92%E5%89%8A%E9%99%A4%2F%2F%E8%A1%8C%E3%82%92%E5%89%8A%E9%99%A4%3CBR%20%2F%3E)%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-546421%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E3%83%87%E3%83%BC%E3%82%BF%E8%A1%A8%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E4%BB%96%E3%81%AE%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-546441%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20For%20%E3%83%AB%E3%83%BC%E3%83%97%20--%20%E3%83%AA%E3%82%B9%E3%83%88%E5%86%85%E3%81%AE%E8%A1%8C%E3%81%A8%E6%95%B0%E5%BC%8F%E3%82%92%E5%89%8A%E9%99%A4%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-546441%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E3%82%84%E3%81%82%3C%2FP%3E%3CP%3E%E5%88%97%E3%81%AE%E5%BD%A2%E5%BC%8F%E3%81%8C%E6%AD%A3%E3%81%97%E3%81%8F%E3%81%AA%E3%81%84%E5%8F%AF%E8%83%BD%E6%80%A7%E3%81%8C%E3%81%82%E3%82%8B%E3%81%93%E3%81%A8%E3%82%92%E6%9C%9F%E5%BE%85%E3%81%97%E3%81%A6%E3%80%81%E3%81%93%E3%82%8C%E3%81%AF%E3%81%86%E3%81%BE%E3%81%8F%E3%81%84%E3%81%8F%E3%81%AF%E3%81%9A%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ecols%3D%7B%22%3Acol_1%22%2C%22%3Acol_2%22%7D%3B%3CBR%20%2F%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FBank%20Loan.jmp%22%20)%3B%0A%3ATime%20%26lt%3B%26lt%3B%20Delete%20Formula%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-546472%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20For%20%E3%83%AB%E3%83%BC%E3%83%97%20--%20%E3%83%AA%E3%82%B9%E3%83%88%E5%86%85%E3%81%AE%E8%A1%8C%E3%81%A8%E6%95%B0%E5%BC%8F%E3%82%92%E5%89%8A%E9%99%A4%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-546472%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ecol_formula%20%3D%20%7B%22Column1%22%2C%20%22Column2%22%7D%3B%0Acol2_row%20%3D%20%7B%22Column3%22%2C%20%22Column4%22%7D%3B%0A%0A%2F%2F%20This%20will%20delete%20the%20formula%0AFor(%20i%20%3D%201%2C%20i%20%26lt%3B%3D%20N%20Items(%20col_formula%20)%2C%20i%2B%2B%2C%0A%20Column(%20col_formula%5Bi%5D%20)%20%26lt%3B%26lt%3B%20Delete%20Formula%3B%20%2F%2Fdelete%20formula%0A)%3B%0A%0A%2F%2F%20You%20cannot%20delete%20a%20row%20within%20a%20given%20column.%20%20JMP%20always%20has%0A%2F%2F%20an%20equal%20number%20of%20rows%20for%20all%20columns.%0A%2F%2F%20You%20can%20delete%20a%20row%2C%20but%20it%20will%20delete%20the%20row%20for%20all%20columns.%0A%0Acurrent%20data%20table()%20%26lt%3B%26lt%3B%20delete%20rows(%20i%20)%3B%0A%0A%2F%2F%20If%20you%20want%20to%20remove%20the%20value%20for%20a%20given%20row%20within%20a%20column%2C%0A%2F%2F%20you%20can%20set%20the%20value%20to%20a%20missing%20value%0A%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
UserID16644
Level V

For loop -- delete row and formula in list

Hi all,

How can I iterate a delete formula then delete column using for loop in list?

Something like this:

col_formula = {"Column1", "Column2" };

col2_row = {"Column3", "Column4"};

For( i = 1, i <= N Items ( col_formula ), i++,
col_formula (i) << Delete Formula //delete formula

col2_row (i) << Delete Row//delete row
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: For loop -- delete row and formula in list

col_formula = {"Column1", "Column2"};
col2_row = {"Column3", "Column4"};

// This will delete the formula
For( i = 1, i <= N Items( col_formula ), i++,
	Column( col_formula[i] ) << Delete Formula; //delete formula
);

// You cannot delete a row within a given column.  JMP always has
// an equal number of rows for all columns.
// You can delete a row, but it will delete the row for all columns.

current data table() << delete rows( i );

// If you want to remove the value for a given row within a column,
// you can set the value to a missing value


 

Jim

View solution in original post

2 REPLIES 2
frank_wang
Level IV

Re: For loop -- delete row and formula in list

Hi

I thick this should be work expect your column format might incorrect.

cols={":col_1",":col_2"};
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Bank Loan.jmp" );
:Time << Delete Formula;
心若止水
txnelson
Super User

Re: For loop -- delete row and formula in list

col_formula = {"Column1", "Column2"};
col2_row = {"Column3", "Column4"};

// This will delete the formula
For( i = 1, i <= N Items( col_formula ), i++,
	Column( col_formula[i] ) << Delete Formula; //delete formula
);

// You cannot delete a row within a given column.  JMP always has
// an equal number of rows for all columns.
// You can delete a row, but it will delete the row for all columns.

current data table() << delete rows( i );

// If you want to remove the value for a given row within a column,
// you can set the value to a missing value


 

Jim

Recommended Articles