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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 567 views
  • 0 likes
  • 2 in conversation