Date: Mon, 23 Sep 2002 13:34:21 -0500
Reply-To: Jun Yan <jyan@STAT.WISC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jun Yan <jyan@STAT.WISC.EDU>
Subject: using index
Content-Type: TEXT/PLAIN; charset=US-ASCII
I can not get the function index work correctly. The following code is in
the data step:
===================================
foo = 'ABCD';
bar = substr(plot, 6, 1);
x = index(foo, bar);
put 'plot=' plot 'foo=' foo 'bar=' bar x;
if index(foo, bar) = 0 then blk = 2;
else blk = 1;
==================================
and the following is from the log file:
plot=HDWDMABI foo=ABCD bar=A 0
plot=HDWDMABI foo=ABCD bar=A 0
plot=HDWDMABI foo=ABCD bar=A 0
plot=HDWDMABI foo=ABCD bar=A 0
I expected x to be 1 for bar=A, but is is 0. Could someone please point
out what I am missing?
Thanks,
Jun
|