cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

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

Theresa
Level IV
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