Date: Sat, 31 May 1997 12:21:03 EDT
Reply-To: Philip Tejera <FXTBB@CUNYVM.BITNET>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Philip Tejera <FXTBB@CUNYVM.BITNET>
Subject: Re: Finding minimum value of a string
Assuming that the examples imply that we are looking for a single digit
and ignoring what to do about zero, the indexc function seems ideal for
the job, as follows. I make use of the fact that we know the order of the
digits, so that the position of 1 in chk is also 1.
11 The SAS System 12:17 Saturday, May 31, 199
1 data _null_;
2 chk = '123456789';
3 p1 = indexc(chk,'72541');
4 p2 = indexc(chk,'6458');
5 put p1= p2= ;
6 run;
P1=1 P2=4
|