Hi. I think the main problem is in the first assignment of date: %let date = 2012-11; While the assumption is that SAS will know what you mean, it is hard without telling SAS that '2012-11' is actually a date, it will not just guess that. OK, the more straightforward explanation is that SAS will not just assume that the list of characters: 2012-11 means a date. Unless YOU tell it so. In a %let statement you can have anything: %let date = this is a date, so that means you cannot simply apply a specific date format to a string and expect SAS to know what you mean. So, again, %let date = 2012-11; translates to a string that does not have the meaning you intended (date). It is just a string of numbers. So, %let date = 2012-11; needs to become something like %let date = '01Nov2012'd; %put &date; %let mydate = %sysfunc(putn(&date, yymmd7.)); %put &mydate.; %let me = %sysfunc(intnx(Month,&date., -1),yymmd7.); %put &me.; I hope this clarifies a bit why you are not getting the expected answers. Good luck, Anca
... View more