As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Looping through tokens in a macro variable with Scan

From sasCommunity
Jump to: navigation, search
%macro scanloop(elements);
  %let j=1;
  %let key=%scan(&elements.,&j.);
  %do %until(&key eq %nrstr( ));
    ... do something with &key ...

    %let j=%eval(&j+1);
    %let key=%scan(&elements.,&j.);

Example usage, where the "do something" part just puts the key to the log:

%scanloop(AAAA BBBB CCCC);