Posted By

webonomic on 01/27/09


Tagged

array


Versions (?)

SAS Array Colon Modifier


 / Published in: SAS
 

Use the colon : modifier to build an array. The colon is like a wildcard. In this case, anything that starts with ash. SAS Arrays hold variable names which can be used during tedious procedures such as conditional loops.

  1. data test1;
  2. input ash1 ash4 ashley;
  3. datalines;
  4. 1 2 3
  5. 4 5 6
  6. 7 8 9
  7. ;
  8. run;
  9.  
  10. data test2; set test1;
  11. array ashes ash:;
  12. c = ashes{1} + ashes{2};
  13. run;
  14.  
  15. /*the result should be as follows:*/
  16. data result;
  17. input ash1 ash4 ashley c;
  18. datalines;
  19. 1 2 3 3
  20. 4 5 6 9
  21. 7 8 9 15
  22. ;
  23. run;

Report this snippet  

You need to login to post a comment.