data test1;
input a b c;
cards;
1 4 .
1 5 .
1 7 7
1 8 .
1 9 9
2 4 4
2 5 .
2 6 6
2 7 .
3 4 .
3 5 5
3 6 .
3 7 7
;
proc sort; by a b c; run;
data test2;
set test1;
by a;
retain seq 1;
if ~missing(c) then do; seq + 1; end;
run;
proc sql noprint;
create table test3 as
select count(seq) as num, seq, a, b, c from test2
group by seq;
quit;
data test4;
set test3;
where seq ^=1 and num=2 and missing(c);
c = b;
run;
data test_final;
set test4 test3(where = (num^=2)) test3(where=(num=2 and seq =1)) test3(where = (num=2 and ~missing(c)));
drop seq num;
run;
proc sort; by a b c; run;
用这个没有d