title: SAS: Compare values in a column
body: <p>I am trying to loop through a column with 50000 rows. I would like to compare the value in say i with (i+1). The only way I know how to do this is by defining an array. However, there is only one variable i.e. The variables column name e.g. Col but 50000 observations  within the column. When I use:</p>
  
  <pre><code>  array Transform {50000} Col
  </code></pre>
  
  <p>where Transform is the name of the array and Col is the column name in my dataset, I receive a subscript error as there are too few variables i.e. Only 1 vs 50000. I have tried replacing {50000} with {50000,1} (and even {*}) so the compiler recognizes that there are 50k observations and only one column. Further I have attempted to transpose the dataset but this seems difficult as I need to add on another variable on to the dataset later which depends on the values of i and (i+1). </p>
  
  <p>Is there a method to loop through the column to compare i and (i+1) using any method (not necessarily an array)? Thanks for the help :)</p>