Thanks for responding. I noticed two things. First is that the %do %until was the problem. When I replaced it by the %do i=1 %to (&theperiod.*12) ; then the code compiled successfully and produced the expected result. The second thing that made it work is by removing the % sign from the if then. Can someone explain to me why especially for the case of the %do %until which did not work? Thanks.
... View more