Hi Spud.
Instead of hard coding today's date and substracting from it, you can let SAS do computations. You can do that with the %SYSFUNC macro function, but it becomes a little boring when you have more than you function to access at a time. So what I think is the most simple solution is to create dates in a Data step, and then record their values, using the Call Symput routine. You can use functions as INTNX to build last month's date, and formats to extract parts of the information.
[pre]
DATA _NULL_ ;
today = TODAY() ;
lastMonth = INTNX("MONTH", today, -1) ;
CALL SYMPUT("tday", PUT(today, DDMMYYN8.)) ;
CALL SYMPUT("yyyy", PUT(today, YEAR4.)) ;
CALL SYMPUT("yyyy2", PUT(lastMonth, YEAR4.)) ;
CALL SYMPUT("mm", PUT(MONTH(today),Z2.)) ;
CALL SYMPUT("mm2", PUT(MONTH(lastMonth),Z2.)) ;
RUN ;
%PUT _USER_ ;
[/pre]
Regards
Olivier