Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Language Reference

Index Creation Operator:   :

creates an index vector

value1:value2

The index creation operator (:) creates a row vector with a first element that is value1. The second element is value1+1, and so on, as long as the elements are less than or equal to value2. For example, the statement

   I=7:10;
results in
              I             1 row       4 cols    (numeric)

                         7         8         9        10
If value1 is greater than value2, a reverse order index is created. For example, the statement
   r=10:6;
results in the row vector
              R             1 row       5 cols    (numeric)

              10          9         8         7        6
The index creation operator also works on character arguments with a numeric suffix. For example, the statement
   varlist='var1':'var5';
results in
         VARLIST    1 row       5 cols    (character, size 4)

                    var1  var2  var3  var4  var5
Use the DO function if you want an increment other than 1 or -1. See the description of the DO function later in this chapter.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.