SAS中文论坛

标题: 关于prxmatch的一个问题 [打印本页]

作者: shiyiming    时间: 2012-5-10 05:56
标题: 关于prxmatch的一个问题
我想找出x=y的record(code如下),但很显然不工作,好像x必须是一个string,而不能是一个变量。可是我查了:
PRXMATCH ([i:q53xtq3p][u:q53xtq3p]regular-expression-id | perl-regular-expression[/u:q53xtq3p][/i:q53xtq3p], source)  
perl-regular-expression
specifies a character constant, [i:q53xtq3p][u:q53xtq3p]variable[/u:q53xtq3p][/i:q53xtq3p], or expression with a value that is a Perl regular expression.
请大家帮忙指点一下,谢谢!!!


data a;
input unid x $ y $;
  re = prxmatch('/x/',y);
cards;
001 abcd abcd
002 defg cdfe
;
run;
作者: shiyiming    时间: 2012-5-13 00:02
标题: Re: 关于prxmatch的一个问题
data a;
input unid x $ y $;
re =(x=y);
cards;
001 abcd abcd
002 defg cdfe
;

data b;
set a;
if re=1;
run;
作者: shiyiming    时间: 2012-5-14 15:07
标题: Re: 关于prxmatch的一个问题
也许这是你想要的:
[code:3lbnbxwm]data a;
input unid x $ y $;
re = prxmatch('/'||strip(x)||'/',y);*修改;
cards;
001 abcd abcd
002 defg cdfe
;
run;
[/code:3lbnbxwm]
作者: shiyiming    时间: 2012-5-16 03:32
标题: Re: 关于prxmatch的一个问题
thanks byes. That is what I wanted.
But why is prxmatch('/'||strip(x)||'/',y), not prxmatch('/x/',y)?
thanks.




欢迎光临 SAS中文论坛 (http://www.mysas.net/forum/) Powered by Discuz! X3.2