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.
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

Recommended Articles