And @SAS-questioner , according to your if/else condition, if any row has all values<=0, the flag of that row is missing, regardless there is -7, -8, and -9 in that row or not. I think this is also the question @PaigeMiller prompted. See the example:
data have;
input q1 q2 q3 q4 q5 q6;
datalines;
20 0 0 4 5 0
20 20 0 -1 -2 0
20 0 -7 1 2 0
0 0 0 0 0 0
0 -8 0 -1 -3 0
-8 -7 -7 -1 -1 0
1 2 3 0 -1 -20
-9 20 1 2 3 1
-7 -1 0 0 -8 -9
-1 -2 -3 -4 -5 -6
0 -1 -2 -3 0 -1
;
run;
proc print data=have;run;
data want (drop=i);
set have;
array q[*] q:;
do i=1 to dim(q);
if q[i]>0 then flag=1;
else if q[i] in (-7,-8,-9)
then flag=.;
else if max(of q:)=0 and
min(of q:)=0
then flag=0;
end;
run;
proc print data=want;run;
... View more