Solved: Re: Remove rows with one or more empty values using JSL - Page 2 - JMP User Community
Based on the above discussion, I have a script to delete empty rows but it appears to delete those where they are empty in ANY of the listed columns, whereas I want to delete those where ALL are empty for the listed columns.
Thanks
// Get the current data table
dt = Current Data Table();
// Get all column names as strings
cnmes = dt << Get Column Names("string");
// Initialize Start and End indices
Start = .;
End = .;
// Find the index of the "Start" column
For(i = 1, i <= N Items(cnmes), i++,
If(Contains(cnmes[i], "Start"),
Start = i + 1;
Break(); // Exit loop once found
);
);
// Find the index of the "End" column
For(j = 1, j <= N Items(cnmes), j++,
If(Contains(cnmes[j], "End"),
End = j-1;
Break(); // Exit loop once found
);
);
datacols = {};
For(k = start, k <= End, k++,
Insert into (datacols, cnmes[k]) // Determine Data Columns
);
keeprows = Loc Nonmissing( datacols );
dt << select rows( keeprows ) << invert Row Selection << delete rows;