cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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