Hi Reeza, thanks for your comment. The table in my original post is the one I want to create. What I have is the first 3 columns (month, growth_A, growth_B). I have historical price of A from Jan, but when I calculated monthly growth rate as in the table, it starts from the following month Feb. So I want to have Jan as a base month so the value of "1" is assigned. For B, I only have historical price from Feb, so the growth rate starts from Mar. For index B, I understand that my code does not give "." for the month of Jan, but I was planning to deal with it after solving the lag function issue. Hi Stat@sas, Thank you so much for your help! I just couldn't think of ways to code this without lag function, but it really makes sense now. I did not know "coalesce" function, but it is useful. Thanks again!
... View more