cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
paulp
Level III

row() results in missing value for 1st row

JMP® Pro 17.0.0 (622753)

 

Hello, I understand that using Lag in the 1st row results in a missing value.  But I need to avoid a missing value, because my predictive algorithm is using Informative Missing elsewhere. So in this one instance, I'd like to avoid it.

 

I'm not much good with JSL...

 

Formula Result: want to force this missing value to change to a zero.  My initial forays have been trying combinations of If statements using Is Empty, Is Missing. e.g.

If Lag (the whole formula) ==Is Empty

Then ==0

Else == Lag (the whole formula)

 

Any suggestions?  thanks, Paul

 

Lag("the whole formula")

paulp_1-1673988610311.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: row() results in missing value for 1st row

Try putting your if statement outside of the lag function.  So..

if( row() == 1, 
	hCounter = 1; // set the hCounter value so future evaluations work, but
	0;, //return 0 for the first row
	lag( ... )
)

View solution in original post

2 REPLIES 2
ih
Super User (Alumni) ih
Super User (Alumni)

Re: row() results in missing value for 1st row

Try putting your if statement outside of the lag function.  So..

if( row() == 1, 
	hCounter = 1; // set the hCounter value so future evaluations work, but
	0;, //return 0 for the first row
	lag( ... )
)
paulp
Level III

Re: row() results in missing value for 1st row

Thank you, that did it