cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
joshua
Level IV

How to get lowest two row values in grouped data ?

Hi,

 

Lets say we have data like this and want to get lowest two row values.

 

Group by Age and Sex, get the two lowest height values.

 

How can we do this in JSL? Thanks

 

joshua_0-1598551468696.png

 

 

 

1 REPLY 1
txnelson
Super User

Re: How to get lowest two row values in grouped data ?

Here is one way to do it

two.PNG

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dtSum = dt << Summary(
	private,
	Group( :age, :sex, :height ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);

dtSum << delete columns( "N Rows" );

dtSum << New Column( "Lowest Values",
	ordinal,
	formula(
		If(
			Row() == 1, x = 1,
			:age != Lag( :age ) | :sex != Lag( :sex ), x = 1,
			x
			++);
		x;
	)
);

dtSum:Lowest Values << delete formula;

dtSum << select where( :Lowest Values > 2 );
dtSum << delete rows;

dtSum << Tabulate(
	Change Item Label( Statistics( Mean, " " ) ),
	Show Control Panel( 0 ),
	Add Table(
		Column Table(
			Grouping Columns( :Lowest Values ),
			Analysis Columns( :height ),
			Statistics( Mean )
		),
		Row Table( Grouping Columns( :age, :sex ) )
	)
);

 

Jim

Recommended Articles