cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
dadawasozo
Level IV

find is missing start from column X till ncol()

Hi,

 

I have a table that has thousand of columns. I want to use column matrix to find if across a range of columns is missing.

 

I first identify the starting of the first column number using Loc().

allcol = dt << get column names(string);

colname = column ("starting column") << getname;

colnumber =  (Loc(allcol ,colname))[1];

 

then I want to find if the columns from colnumber till ncol() is missing.  something like below but it failed. can someone point me how I can make it right ? 

dt << select where (ismissing(column()[colnumber :: ncol()]))

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: find is missing start from column X till ncol()

Here is an example of finding rows that have missing values within a range of columns for each row.

Names Default To Here( 1 );
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
// for example purposes set some random cells to missing values
For( i = 1, i <= Random Integer( 1, 100 ), i++,
	random row = Random Integer( 1, 1455 );
	random col = Random Integer( 5, 132 );
	dt[random row, random col] = .;
);

starting colName = "NPN1";
allcol = dt << get column names( string );
starting col = Contains( allcol, starting colName );
rowsWithMissing = [];

For Each Row(
	mat = dt[Row(), starting col :: N Col( dt )];
	If( Length( Loc( mat, . ) ) > 0,
		rowsWithMissing = rowsWithMissing || matrix(row());
	);
);
show(rowsWithMissing);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: find is missing start from column X till ncol()

Here is an example of finding rows that have missing values within a range of columns for each row.

Names Default To Here( 1 );
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
// for example purposes set some random cells to missing values
For( i = 1, i <= Random Integer( 1, 100 ), i++,
	random row = Random Integer( 1, 1455 );
	random col = Random Integer( 5, 132 );
	dt[random row, random col] = .;
);

starting colName = "NPN1";
allcol = dt << get column names( string );
starting col = Contains( allcol, starting colName );
rowsWithMissing = [];

For Each Row(
	mat = dt[Row(), starting col :: N Col( dt )];
	If( Length( Loc( mat, . ) ) > 0,
		rowsWithMissing = rowsWithMissing || matrix(row());
	);
);
show(rowsWithMissing);
Jim

Recommended Articles