Hi Tom, THANK YOU VERY MUCH !!! You find where the bug is. Yes, you are wright, looping of k value should be in innner loop. I have one more question for you. Some of my tables are like data_201203, data_201206,data_201209,data_201212 for year 2012 and data_201303,data_201306,data_201309, and data_201312 for year 2013. Here datasets have represented quater by 03, 06, 09 and 12 instead of 3,6,, and 9. So, how the counter of k should be written. I tried to run with %do k= 03 %to 12 %by 3; and it gave errors while reading table for 4th quater (i.e data_201212 and data_201312). Because code will read a table like data_2012012, and it did not find the table. I have just uploaded my sas code (please see the attachment) which I ran a little while before, and I ended up with errors. Thanks in advance, _kamal
... View more