SAS - Define array of letters

Viewed 1278

Is there a shorthand in SAS for defining a sequence of letters in an array?

Many languages possess a mechanism for doing so easily and I imagine SAS does too, although I'm unable to find a reference for it.

For instance, in R I could do

> x <- letters[1:4]
> x
[1] "a" "b" "c" "d"

In Python, one way is

>>> import string
>>> list(string.ascii_lowercase[:4])
['a', 'b', 'c', 'd']

In SAS, I currently am having to list the letters explicitly,

data _null_;
  array letters (4) $ _temporary_ ('a', 'b', 'c', 'd');
  do i = 1 to hbound(letters);
    put letters(i);
  end;
run;
4 Answers
Related