Hi Droopy,
To do this, I would convert your text string to a normal date, then make use of the INTNX function to go forward a month, then back a day.
For example, 200908 would be converted to 08/01/2009 (sticking with US style dates). Jump forward a month to 09/01/2009, then go back a day to 08/31/2009.
The below code create a sample dataset with months stored as text, and then does the above calculation.
data months;
format month $10.;
input month $;
datalines;
200002
200908
200402
;
run;
data months;
set months;
format last_day date9.;
last_day = intnx('day',intnx('month',input(month,yymmn6.),1),-1);
run;
The Input function converts the text date to its numerical equivalent, then intnx is used as above.
Hope that helps.