07-16-2013 08:16 AM
Amir's proposed solution is pretty much your only hope. If somehow one of your date format isn't supported by the anydate format used, or (and you should spend some verification time on this) messes up years and days for some format, you are pretty much bound to importing them as character, creating a custom solution with a series of if covering all the different formats in your dataset to input them into a new numeric date variable with the proper format.
*edit* If you have 6-digit dates that are always of the same form mdy, dym, ydm etc., look for the DATESTYLE= system option with your anydtdte format.
07-16-2013 01:45 PM
If you have data as in your example:
input date format;
How will you know the meaning of 07/03/1990 ? Any of the month/day 01 to 12 will be extemely problematical as to accuracy when the month/day and day/month is not entered with a fixed standard pattern.
07-16-2013 02:37 PM
If there is really a case where YMD/DMY etc. can be different, then anydtdte won't work and you are stuck with a custom solution. That is, reading them as a string, using a bunch of ifs with substring or prx and using input(var, properformat.). Sadly though if there is no additionnal variable to allow to distinguish 03/07/1990 from 07/03/1990, there really isn't anything that you can do nor that SAS can do.
Well, in theory, anydtdte can still read all dates. It will read unambiguous dates (like 24/12/1990 vs 12/24/1990) properly but will use whatever the DATESTYLE= system option is set to for all ambiguous cases.