有2个文件,一个文件file1里有个variable 就叫name,另一个文件file2有个variable就叫term. 想找出所有的name里包含term字符的oberveration.写个一个程序如下“
DATA file2;
length term term1 $28.;
SET BADWORD0;
TERM = '%'||TRIM(UPCASE(TERM1))||'%';
RUN;
proc sql;
select "(name like'" || trim(term) || "')" into :macrovar separated by " or " from file2;
create table matches as select * from file1 where ¯ovar);
quit;
这个程序能找出在name里有term字符串。但是想要在match table 里也包括term一个column.又写了一个程序如下:
proc sql;
create table matches1 as
select file1.* , file2.term
from file1, file2
where file1.name like file2.term
order by 2;
quit;
但是2个程序的查找出的结果不一样, matches1 要比matches 少好些
请教问题出在哪里?怎么解决这个match的问题。 先谢