string juggling, just like spinning plates %let myStr =fileNameXy_blah_blah07282015.csv; *1234567890123456789012345678901234567890; * ^------^; %let length_date = %length(mmddccyy); %put &=length_date; %let position_dot =%index(&mystr,.); %put &=position_dot; %let number = %substr(&mystr,%eval(&position_dot - &length_date),&length_date); *eval not necessary in previous line; %put &=number; %let date = %sysfunc(mdy (%substr(&number,1,2) ,%substr(&number,3,2) ,%substr(&number,5,4) )); %put &=date;*is.a SAS date; %put %sysfunc(putn(&date ,weekdate29.)); see also the page and paper Macro Loops with Dates http://www.sascommunity.org/wiki/Macro_Loops_with_Dates hth
... View more