waxinigou
求助各位大侠
问题:
x,y分别是两个变量,字符型
现在我想看x中是否含有y这个字符串,含的话赋值c=y否则c=0
我的程序如下:
if index(x,y)>0 then c=y;
else c=0;
可是结果总是显示c=0
请问大侠这是什么原因,谢谢
losttemple
strip(y) first
waxinigou
谢谢回复,还是不行
我做了个小的实验:
data aa;
input a $ b $ @@;
cards;
ni1 ni wo ta heo he
;
data bb;
set aa;
n=strip(a);
m=strip(b);
if index(upcase(n),upcase(m))>0 then c=1;
run;
结果:
Obs a b n m c
1 ni1 ni ni1 ni .
2 wo ta wo ta .
3 heo he heo he
losttemple
data bb;
set aa;
if index(a,strip(b))>0 then c=1;
run;
waxinigou
太感谢了
问题解决了
zhaoy
[quote]引用第1楼losttemple于2008-07-23 11:21发表的“”:
strip(y) first[/quote]
这个表示什么意思呢?
wheat_myj
同问 strip是什么函数
王笑权
这个函数难
losttemple
STRIP(string) returns the same result as TRIMN(LEFT(string)) , but the STRIP function runs faster.