03JAN2011:00:00:00.000
which format should I use to read this date ?
Depends upon what you want. That is a datetime, not a date. If you want to capture all three you could use something like:
data have; input dt datetime22.; format date date9.; format time time5.; date=datepart(dt); time=timepart(dt); cards; 03JAN2011:00:00:00.000 ;
Art, CEO, AnalystFinder.com
You need an informat to read data not a format - try datetime22. (Untested)
If all of the values have the same "time", especially of :00:00:00.000 I would use a DATE9. informat to read the date and discard the time part.
Don't forget to set a display format so humans can see the date in a useable form.
When in doubt try ANYDTDTM for datetime and ANYDTDTE for dates.
Thanks, everyone
.
I used Datetime22.3 format and it successfully reads that observation.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.