Use INTNX() function to generate a relative date. You can apply MONYY5. format to convert it to MONyy format. But perhaps what you want to do is find the file with the latest name? You can query the list of table names from the metadata if you want and parse the table name into the pieces so that you can convert the middle of the name back to a date that you can then compare to any reference date, not just today. * Make some example tables ; data link_MAY14_he link_APR14_he link_MAR14_he ; run; %let refdate='01APR2014'd ; %let dsn=NOT_FOUND ; proc sql noprint ; select memname into :dsn separated by ' ' from ( select memname , input(scan(memname,2,'_'),MONYY5.) as month format monyy5. from dictionary.members where libname='WORK' and scan(memname,1,'_')= 'LINK' and scan(memname,3,'_')= 'HE' and input(scan(memname,2,'_'),MONYY5.) <= &refdate ) having month = max(month) ; quit; %put dsn=&dsn ;
... View more