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
anne_sa
Level VI

How do I check that a column contains only integers?

Hello,

 

I need to check that a column contains only integers before running the rest of my script but I don't know how to do that. Ideally I would like to be able to identify precisely the rows with decimal values.

 

Thanks in advance for your help!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How do I check that a column contains only integers?

See the last line.

Names Default to Here( 1 );

// generate test case with a mix of 90% integers and 10% non-integers
data = J( 30, 1,
	If( Random Uniform() < 0.1,
		Random Normal(),
		Random Integer( -6, 6 )
	);
);

// check results
Show( data );

// make a data table example
dt = New Table( "Test Cases",
	New Column( "Data", Numeric, Continuous,
		Values( data )
	)
);

// now the solution
nonIntegersHere = dt << Get Rows Where( Modulo( :Data, 1 ) );

View solution in original post

2 REPLIES 2

Re: How do I check that a column contains only integers?

See the last line.

Names Default to Here( 1 );

// generate test case with a mix of 90% integers and 10% non-integers
data = J( 30, 1,
	If( Random Uniform() < 0.1,
		Random Normal(),
		Random Integer( -6, 6 )
	);
);

// check results
Show( data );

// make a data table example
dt = New Table( "Test Cases",
	New Column( "Data", Numeric, Continuous,
		Values( data )
	)
);

// now the solution
nonIntegersHere = dt << Get Rows Where( Modulo( :Data, 1 ) );
anne_sa
Level VI

Re: How do I check that a column contains only integers?

What a beautiful solution!! Thanks @Mark_Bailey 

Recommended Articles