hi .. lots of answers posted already, but here's another (it uses TRANSPOSE like a few others) that uses the SMALLEST function ... * some fake data (10 random ids, 10 numeric variables); data have; array x(10); do j = 1 to 10; id = put(ceil(1000*ranuni(999)),z4.); do k = 1 to 10; x(k) = ceil(100*ranuni(999)); x(k) = ifn(ranuni(999) le .3, x(k)*-1, x(k)); end; output; end; drop j k; run; proc transpose data=have out=want; var _numeric_; run; * use SMALLEST (use COUNTC to determine the number of values to skip); data want; set want; smallest_positive = smallest(countc(cats(of _numeric_),'-') + 1, of _numeric_); which_obs = whichn(smallest_positive, of _numeric_); set have (keep=id) point=which_obs; keep sm: id _name_; run; results ... smallest_ _NAME_ positive id x1 12 0778 x2 14 0778 x3 16 0423 x4 13 0609 x5 16 0031 x6 8 0031 x7 8 0352 x8 21 0750 x9 15 0750 x10 3 0491
... View more