cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
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