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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.