Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

Macro Do Loops does only one iteration

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Macro Do Loops does only one iteration

Hi,

 

I am running a simulation experiment in  a loop. I have written a macro to run simulation for multiple times. The macro runs only once and produces no errors or warnings. I checked the syntax and also spent quite some time on debugging this. Everything seems fine.

Am i missing something?

 

 

Attachment

Accepted Solutions
Solution
‎02-07-2017 01:47 PM
Super User
Super User
Posts: 6,681

Re: Macro Do Loops does only one iteration

Your macro has a %DO loop that uses the macro variable I.

One possiblity is that somewhere in some of the included program files you are setting the value of I to 3 or more so that the DO loop ends.

View solution in original post


All Replies
Solution
‎02-07-2017 01:47 PM
Super User
Super User
Posts: 6,681

Re: Macro Do Loops does only one iteration

Your macro has a %DO loop that uses the macro variable I.

One possiblity is that somewhere in some of the included program files you are setting the value of I to 3 or more so that the DO loop ends.

Super User
Posts: 10,833

Re: Macro Do Loops does only one iteration

You might try something like

%put After datamanipulation.sas i=&i;

after each of the %include.

Or if you have any macros in any them ensure that all of their macro varaibles are explicitly set to Local.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 146 views
  • 0 likes
  • 3 in conversation