|
Kristin,
The expression (assuming Version 9):
indexc (compress (put (collate (0,255), $256.),,"lk"), letter)
where LETTER is a 1-byte variable containing your lowcase letter will
return each letter's lexicographic sequence starting with 1 regardless of
the operating system's collating sequence (i.e. irrespective of ASCII or
EBCDIC). To check, run the step below and observe the log:
data _null_ ;
lowcase = compress (put (collate (0,255), $256.),,"lk") ;
do i = 1 to 26 ;
letter = char (lowcase, i) ;
n = indexc (compress (put (collate (0,255), $256.),,"lk"), letter) ;
put letter n 2.-R ;
end ;
run ;
An advantage of having V9 under the belt and using the relatively complex
expression above is that you do not depend on [mis]typing the
string "abcdefghijklmnopqrstuvwxyz". Of course, if this is a non-issue,
then the primitive expression
indexc ("abcdefghijklmnopqrstuvwxyz", letter)
works under any version, at least from 6 to 9, and any collating sequence.
Kind regards
------------
Paul Dorfman
Jax, FL
------------
On Mon, 22 Jun 2009 17:04:19 -0400, Kristin Graves <gravesk@CONED.COM>
wrote:
>Is there a function that translates the (English) alphabet into the order
>of the letters, i.e., a=1, b=2, c=3, etc?
>
>thanks,
>Kristin Graves
|