sas

DO Loop

DO Loop

DATA salary;
    /*define variables*/
    raise=0.1;
    salary=50000;
    year=1;
    /*do loop*/
    DO year=1 to 20 by 2;
        salary + salary*raise;
        output; /*generates an observation for each iteration of the do loop, optional*/
    END;
RUN;

Macro do loop

%macro doloop;
  %do age=11 %to 15 %by 2;
    title Age=&age.;
    proc print data=sashelp.class(where=(age=&age.));
    run;
  %end;
%mend;
%doloop;

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow