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
GroupSquareWolf
Level III

Is Missing command- Scrippting

GroupSquareWolf_0-1663088934362.png

In this example, ;"Sum of A+B+C" calculates sum of :A + :B + :C in each row with this formula:

 

If( Is Missing( :A ), 0, :A ) + If( Is Missing( :B ), 0, :B ) + If( Is Missing( :C ), 0, :C )

If I change the specific column names to with column number, the script is not working anymore and generates an error 

If( Is Missing( Column( 1 ) ), 0, Column( 1 ) ) + If( Is Missing( Column( 2 ) ), 0, Column( 2 ) ) + If( Is Missing( Column( 3 ) ), 0, Column( 3 ) )

 

GroupSquareWolf_2-1663089213081.png

 

What am I missing here?

 

4 REPLIES 4
jthi
Super User

Re: Is Missing command- Scrippting

If you are using Column() I think you will also have to provide row number. For example:

 

Column(1)[Row()]

(AsColumn(Column(1)) might also work).

 

Also using

 

Sum(:A, :B, :C)

should work without IsMissings

 

-Jarmo
Jeff_Perkinson
Community Manager Community Manager

Re: Is Missing command- Scrippting


@jthi wrote:

 

Also using

 

Sum(:A, :B, :C)

should work without IsMissings


I would second this. It looks like you're just trying to avoid the propagation of missing values that the + operator does and, as @jthi points out the Sum() function does just that. More information here: Add() vs. + vs. Sum(): What’s the difference? 

-Jeff
ErraticAttack
Level VI

Re: Is Missing command- Scrippting

Put a [] at the end of your Column() functions:

 

ErraticAttack_0-1663100083080.png

Jordan
Craige_Hales
Super User

Re: Is Missing command- Scrippting

The empty square brackets tell JMP to index the current row of the column. Using [row()] is the same idea. Without them, the data type is a column, not a number, and isMissing requires a numeric argument.

 

The sum() function is a great choice for this.

Craige