Help using Base SAS procedures

Using Macro function in DO LOOP

Reply
Frequent Contributor
Posts: 128

Using Macro function in DO LOOP

I created a macro function: %gcheck(i);
and I need to run

%gcheck(1);
%gcheck(2);
%gcheck(3);
....
%gcheck(1000);

how can I do this using DO LOOP?

Thank you so much!!
Super Contributor
Posts: 474

Re: Using Macro function in DO LOOP

To use the %do ... %loop, It must be placed inside another macro:

%macro loop_gcheck;

%do I=1 %to 1000;
%gcheck(&I);
%end;

%mend loop_gcheck;

%loop_gcheck;

Check the following Macro tutorial from John Cohen:
http://www.nesug.org/Proceedings/nesug03/bt/bt009.pdf

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
Frequent Contributor
Posts: 128

Re: Using Macro function in DO LOOP

Thanks alot!!
It works!!
Ask a Question
Discussion stats
  • 2 replies
  • 115 views
  • 0 likes
  • 2 in conversation