Try removing the parentheses around the two findw conditions....it seems to work for me.
data T_USER_EMAIL;
length userid $6 email $100;
userid='ABC090'; email='john.smith@xyz.com'; output;
userid='DEF090'; email='joanna.smythe@xyz.com'; output;
userid='HIJ090'; email=' '; output;
run;
* test with Name;
proc sql noprint;
create table test_A1 as
select *
from T_USER_EMAIL
where index(upcase(email),'@XYZ.COM')
and (FINDW(" JOHN.SMITH xxx",strip(upcase(scan(email,1,'@'))),' ')) or
(FINDW(" JOHN.SMITH xxx",strip(upcase(userid)))) ;
quit;
proc sql noprint;
create table test_A2 as
select *
from T_USER_EMAIL
where index(upcase(email),'@XYZ.COM')
and (FINDW(" JOHN.SMITH xxx",strip(upcase(userid)))) or
(FINDW(" JOHN.SMITH xxx",strip(upcase(scan(email,1,'@'))),' ')) ;
quit;
* test with UserId;
proc sql noprint;
create table test_B1 as
select *
from T_USER_EMAIL
where index(upcase(email),'@XYZ.COM')
and (FINDW("DEF090 xxx",strip(upcase(scan(email,1,'@'))),' ')) or
(FINDW("DEF090 xxx",strip(upcase(userid)))) ;
quit;
proc sql noprint;
create table test_B2 as
select *
from T_USER_EMAIL
where index(upcase(email),'@XYZ.COM')
and (FINDW("DEF090 xxx",strip(upcase(userid)))) or
(FINDW("DEF090 xxx",strip(upcase(scan(email,1,'@'))),' ')) ;
quit;
... View more