Date: Thu, 27 Jun 2002 11:25:07 -0700
Reply-To: MNess@CROMEDICA.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Matthew Ness <MNess@CROMEDICA.COM>
Subject: Re: INDEX question
Content-type: text/plain; charset=us-ascii
Hi Robert,
The fields fname_dmv and lname_dmv seem to be padded with trailing blanks
so the index function is in fact looking for the following strings 'GRADDY
' and 'VICTORI '. Those obviously don't show up in the lname
and fname fields. So just add the trim or compress function to the excerpt
part of the index function and it should work fine.
HTH,
Matt
Robert
Matthews To: SAS-L@LISTSERV.UGA.EDU
<rsm@UAB.EDU> cc:
Sent by: Subject: INDEX question
"SAS(r)
Discussion"
<SAS-L@LISTSER
V.UGA.EDU>
27/06/02 11:11
AM
Please respond
to Robert
Matthews
Can someone please offer some insight into this code. I've used the index
function for years, but when I run this program, I expect the value of L2
and F2 to equal 1. Yet the values are zero. I don't understand what is
happening. Suggestions?
I'm using v8.2 on Win 2k PRO.
data test;
length lname lname_dmv $20 fname fname_dmv $15;
input fname lname fname_dmv lname_dmv;
l1=index(lname_dmv,lname); l2=index(lname,lname_dmv);
f1=index(fname_dmv,fname); f2=index(fname,fname_dmv);
put l1= l2= f1= f2= lname= lname_dmv= fname= fname_dmv=;
cards;
VICTORIA GRADDYWHITE VICTORI GRADDY
;
run;