SASkiwi right as you are, there are still times when I cannot "fix the source" There is a solution to this problem - even as it is defined - (although it feels hard to swallow) We can create a format to do this. It needs a date range defined and as I have seen formats with a million ranges, it seems almost acceptable to create the format that converts a string date in one standard format to a string date in another. For example to support a century needs only approx 36555 ranges - double that 2 centuries need less than 100K ranges. %let y1range = 1890 ; %let y2range = 2130 ; data cntlinD ; retain type 'C' fmtname 'DAT1CNV' ; *YYYYMMDD to MM/DD/YYYY ; do date = mdy( 1,1,&y1Range ) to mdy( 12,31, &y2Range ); start = put( date, yymmddN8. ) ; label = put( date, mmddyy10. ) ; output ; end ; run ; proc format cntlin= cntlinD ; run ; %put demo date test= 22Jul2015 21050722 becomes %sysfunc( putc( 21050722, $dat1cnv. )) ; On my little system the result line in the log shows demo date test= 22Jul2015 21050722 becomes 07/22/2105 The 240 year interval over which this informat supports the string date conversion, required only 88 thousand ranges in the format It could be extended to create an error report for dates outside this range, but that seemed overkill; (to me) Hope this provides a simple enough demo of how this format can be created. To make it generally applicable, see your systems administrator, or have a look at the system option INSERT= with value FMTSEARCH To apply the new format permanently to a list of variables (&varlist ) in a table (&table) proc datasets library = %scan(&table,1,.) nolist ; modify %scan(&table,-1,.) ; format &varlist $dat1cnv. ; run ; quit ; One beauty of this method (a new format applied with proc datasets) is you update only headers and not the stored data. If you consider implementing this, I would suggest generally using the system option NOFMTERR. cheers Peter Message was edited by: Peter Crawford
sorry
Defect1:
The format ddmmyyN has max width 8 so I have correct that bit of code.
... View more