LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page