cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Theresa
Level IV

Data table - If one column has empty value, then use other column value to fill in,other row keep no change

Names Default To Here( 1 );

//If the original data table is like below, 
// there are 2 empty value(:sex[3] and :sex[4] )in column sex:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:sex[3 4] = black;

 

I want the function is:

when search all values in column :sex, if find column sex have empty value, then fill the column :name value into the empty position in :sex while keep other value in :sex with no change.

1 REPLY 1
jthi
Super User

Re: Data table - If one column has empty value, then use other column value to fill in,other row keep no change

One way to script it would be using << set each value with if to check for empty string (if numeric you have to change the if to use IsMissing()).

 

names default to here(1);

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:sex[3::4] = "";

dt:sex << Set Each Value(If(:sex == "", :name, :sex));

 

-Jarmo