BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Demographer
Pyrite | Level 9

Hi,

I have a macro "microsim" with 2 parameters, which are a starting year and an ending year. I want to loop this macro by increasing the year by 5 from 2010 until 2060.

In other words, the loop should do:

%microsim(2010,2015);
%microsim(2015,2020);
%microsim(2020,2025);

...

%microsim(2055,2060);

 

I was thinking to do something like:

%macro loop(start,end);
   %local year;
   %do year = &start %to &end;
      %microsim (&start, %eval(&year+5))
   %end;

%mend loop;
%loop(2010, 2060);

But the do statement increases by 1 while I want by 5;

1 ACCEPTED SOLUTION
1 REPLY 1

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 581 views
  • 0 likes
  • 2 in conversation