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.
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.
Ready to level-up your skills? Choose your own adventure.