I believe the following script will accomplish your goal...please verify its functionality before permanently altering your data. To remove unwanted rows, first sort your worksheet in ascending order by the X dataset. Then, copy paste the script to the Script Window (select Window:Script Window to open the Script Window), highlight the entire script, and press the ENTER key to run it.The script deletes all rows that contain duplicate X values and at least one missing Y value. If this is not exactly what you want, please feel free to modify the script as needed.
//////////////////////////////////////////////////////////////////////
// Script Name: DelDupXRows
//////////////////////////////////////////////////////////////////////
/*
Description:The script DelDupXRows deletes all rows in a worksheet that contain
duplicate X values and that have at least one missing value in the row.
Assumptions: 1) The active window is a worksheet window that contains
at least one X dataset and one Y dataset. The X
dataset must be column 1.
2) The worksheet is sorted on the X values in ascending
order.
Arguments: None.
Code:
*/
get col(1) -e nrows; // Get nrows in X column
ncols=wks.ncols; // Get ncols in worksheet
kk=0; // Init delrow array index
create delrow -n nrows/2; // Create delrow array
loop(ii,1,nrows) { /* Loop on nrows in X column */
// If X value is a duplicate of previous or subsequent row then...
if((col(1)[ii]==col(1)[ii-1]) | | (col(1)[ii]==col(1)[ii+1])) {
loop(jj,2,ncols) { /* Loop on columns for the row */
if(col($(jj))[$(ii)]==(0/0)) {/* If row contains missing value */
kk+=1; // Increment index for delrow
delrow[kk]=ii; // Save row num to delete
break; // Break out of innermost loop
};
};
};
};
for(ii=kk;ii>0;ii--) { /* For each element in delrow loop backwards */
mark -d %(%H,1) -b delrow[ii] -e delrow[ii]; // Delete the row
sec -p 0.1; // Wait 0.1 sec for worksheet to update
};
delete delrow; // Delete the delrow array
[This message has been edited by Gary Lane (edited 01-05-99).]