Search code examples
sqlsassas-macro

Is it possible to loop through an entire process flow n times?


I'm currently working on an important project where we use logistic regression to predict events.

The thing is, I need to generate 2 distinct sample of 1500 peoples then process a logistic regression. This whole process should be looped 50 times minimum. Do you know a way to loop it 50 times?

I tried with a macro:

%macro repeat
    %do i = 1 %to 50;
      [...]
      output;
      end;
    run;
%mend;
%repeat(50);

But it won't work. Do you have any idea?


Solution

  • To solve the problem, I had to trick the editor into thinking it have reached the end of the whole macro. Juste insert the code below under %macro :

    %local DUMMY;
    %let DUMMY = %nrstr(%mend);
    

    If you're seeking for repetition of SURVEYSELECT then just add REPS=n

    You can check full answer here: Why does my code inside my macro is not taken into account?