Hi Jean, Along the lines of what Ned was saying, here are two examples: 1) If "1" is equivalent to your missing value, you can do set var/bad=1 a let b = samplei(compressi(a),x[gx=1:`a[i=@ngd]`:1]) Here we set A's missing value to 1. We then compress the valid values of A to the front of the variable, and then sample that compressed variable only up to the number of valid (good) values -- giving a result array of the correct size, without any trailing missing values. 2) If you already have a missing value (say, -1e34), and you want to designate "1" as an additional missing value, you can do let a_cmp = compressi(IF a NE 1 THEN a) let b = a_cmp[i=1:`a_cmp[i=@ngd]`] This sets the 1 values to missing (without unmasking any prior missing values), compresses the remaining valid values to the front, and then samples up to the number of valid values. Cheers, Andrew On Wed, 16 Jun 2010, jean li wrote:
Hi All: I'd like to get the abnormal values from an array, e.g. a={1,1,1,500,1,1,1,1,1,600,1,1,560} The new array will be b={500,600,560}. How can I do this? Note that using the "if" statement will give me the array that is of the same size as "a", and @loc is for finding the indexes with the constant values. Thanks very much for your help. Jean