/*方法1*/
/*此方法最直观,但是,如果v5变量含多条记录,编程会变成很长。*/
data c;
set a;
if index(v1,"张三")>0 or index(v2,"张三")>0 or index(v3,"张三")>0 or index(v4,"张三")>0 then yes=1;
if index(v1,"李四")>0 or index(v2,"李四")>0 or index(v3,"李四")>0 or index(v4,"李四")>0 then yes=1;
if index(v1,"吴7")>0 or index(v2,"吴7")>0 or index(v3,"吴7")>0 or index(v4,"吴7")>0 then yes=1;
if yes=1;
run;
/*方法2*/
/*此方法把数据集a的v1-v4变量赋予数组x,再用index()函数找出符合条件的记录*/
data c;
set a;
array x v1-v4;
do i=1 to all;
set b nobs=all point=i;
do j=1 to dim(x);
if index(x{j},compress(v5))>0 then output;
end;
end;
drop i j v5;
run;