比如下面这个测试数据集:
data a;
input t1 $ t2 $ t3 $ t4 $ t5 $;
cards;
e d c b a
f c b a .
;
run;
需求如下:对每一条记录按照顺序取三个字母,第一条记录得到如下结果:e d c;e d b;e d a; e c b;e c a;e b a;第二条记录得到如下结果: f c b; f c a; f b a,最终输出SAS数据集如下:
e d c
e d b
e d a
e c b
e c a
e b a
data b;
set a;
keep x1-x3;
array temp(5) t1-t5;
do i=1 to 3;
do j=i+1 to 4;
do k=J+1 to 5;
x1=temp(i);
x2=temp(j);
x3=temp(k);
if not (missing(x1) or missing(x2) or missing(x3)) then output;
end;
end;
end;
run;