Posted By

webonomic on 07/24/13


Tagged

list character loop macro values iterate


Versions (?)

Allow a list of non-numeric values for an iterative macro %DO loop


 / Published in: SAS
 

More details here: https://communities.sas.com/ideas/1084

  1. /*If you have a short list of items:*/
  2.  
  3. %let _items= January/April/June/December;
  4. %macro t;
  5. %let _len=%eval(%sysfunc(countc(&_items,/)) + 1);
  6. %do _i=1 %to &_len;
  7. %let _item=%scan(&_items,&_i);
  8. %put "&_item";
  9. %end;
  10. %mend;
  11.  
  12. /*If it is a long list (exceding 64k in byte), put them in a SAS data set.
  13. Loop through all then items using SAS data set direct access with "point=" option.*/

Report this snippet  

You need to login to post a comment.