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

LAG function

Hi All, 

 

I'm hoping this is an easy line of code someone can help me with. 

I have a LAG function script written, but it's not letting me grab the first Run. 

 

How can I get it to see that there's a Run 1, and not just skip it?

Attached is the data.

 

Thanks!

 

Here's my script:

Names Default To Here( 1 );

dt = Current Data Table();
dt << select where( :name( "Run" )[Row()] != Lag( :name( "Run" )[Row()] ) );

dtNew = dt << subset( selected columns( 0 ), selected rows( 1 ) );

 

1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller
Super User (Alumni)

Re: LAG function

add | row() == 1

 

dt << select where( :name( "Run" )[Row()] != Lag( :name( "Run" )[Row()] ) | Row() == 1 );
Vince Faller - Predictum

View solution in original post

2 REPLIES 2
vince_faller
Super User (Alumni)

Re: LAG function

add | row() == 1

 

dt << select where( :name( "Run" )[Row()] != Lag( :name( "Run" )[Row()] ) | Row() == 1 );
Vince Faller - Predictum
kwmcm
Level III

Re: LAG function

THANK YOU!

Recommended Articles