cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
JesperJohansen
Level IV

If-function else-clause not recognizing missing values

If I add an If-function  to a column, the else-clause does not recognize empty values (see attached sheet). this means that the function:

If( :Column 2 == 1, 1,

2 )

leaves missing values if Column 2 contains missing values. I can fix this by changing the function to:

If(  :Column 2 == 1, 1,

  Is Missing( :Column 2 ), 2)

or

If(  :Column 2 == 1, 1,

  Is Missing( :Column 2 ), 2,

  2)

but why is this necessary? Is it a bug or a deliberate "feature"?

BR
Jesper
1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: If-function else-clause not recognizing missing values

This behavior is intentional and is associated with the propagation of missing values. Your can read a bit about it in the Conditional Functions section of the JMP Scripting Guide.

You should always include a check for missing values in your conditionals.

-Jeff

-Jeff

View solution in original post

3 REPLIES 3
Jeff_Perkinson
Community Manager Community Manager

Re: If-function else-clause not recognizing missing values

This behavior is intentional and is associated with the propagation of missing values. Your can read a bit about it in the Conditional Functions section of the JMP Scripting Guide.

You should always include a check for missing values in your conditionals.

-Jeff

-Jeff
Jeff_Perkinson
Community Manager Community Manager

Re: If-function else-clause not recognizing missing values

If you want to understand why it behaves this way, run this code in your head (and then try it in JMP):

x = .;

If( x < 5, Show( "X is less than five" ),

x>5, Show( "X is greater than five" ),

Show("X is equal to five")

);

What did you think it would do?

-Jeff
JesperJohansen
Level IV

Re: If-function else-clause not recognizing missing values

I think I came to the same conclusion upon more consideration. That "missing" is not the same as "X is equal to five" in your example. Or whatever else may be placed in the "else" clause.

Thank you

BR
Jesper