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


/ Published in: SAS
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.