data test_new (drop=flag_2) ;
set test ;
array test test1-test5 ;
do i = 1 to 5 ;
if test[i] > 2 then flag_2 = 1 ;
if test[i] < 2 and low_2 = . then low_2=test[i] ;
if low_2 ne . and high_2 = . and test[i] > 2 then high_2 = test[i] ;
end ;
if flag_2 = . then delete ;
drop i ;
run;
data test1(drop=i );
set test;
array test{*} test1-test5;
do i=1 to dim(test) ;
if ^missing(test{i}) & test{i}<2 then do; keep=test{i} ; i=dim(test); end;
end;
if max(of test:)<2 then delete;
run;