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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.