do i=1 to 18 by 1;
mm1=mm-i;
if mm1>0 then M_i=yyyy*100+mm1;
if -12<mm1<=0 then M_i=(yyyy-1)*100+mm1+12;
if mm1<=12 then M_i=(yyyy-2)*100+mm1+18;
end;
run; Hello, I know the code above totally wrong and still working on it. Meanwhile, I need your help as I feel I cannot do that myself. What I want to do is to create multiple M_i variables which are several months ahead based on specific other dates. Examples are: M_18 mean 18 months ahead, and M_1 is 1 month ahead. YYYMM M_18 M_1 199808 199702 199807 199801 199607 199712 What I am struggling with are... 1. I do not know how to create variables that also vary by loop statement with "i". I want to create M_18 to M_1, and think there is a way to use simple programming instead of designating M_1 to M_18 each. 2. I think that the do loop above does not work because I just write M_i, how do I make loop or iteration happen there? If not using do loop, I must write M_1 = blahblah to M_18 = blahblah. This was what I first did and changed my mind to work in this way but hardly made it. I appreciate your help a lot!!
... View more