I have dates of this format: '2018-04-19T06:16' stored as $16 (format) and $200 (informat). I want to create a separate date (date9) and time (time5) from this.
I tried the following code but ended up with "NOTE: Invalid argument to function INPUT". I assume the issue may be the format I am attempting to give it is wrong, but I don't see the format I have listed in https://documentation.sas.com/doc/en/vdmmlcdc/1.0/leforinforref/n0av4h8lmnktm4n1i33et4wyz5yy.htm
dtm = input(dtc, datetime16.);
dt = datepart(dtm);
tm = timepart(dtm);
That T means you need a quite different informat:
data example; x='2018-04-19T06:16'; dt = input(x,e8601dt.); format dt datetime.; run;
https://documentation.sas.com/doc/en/vdmmlcdc/1.0/leforinforref/p0jd9jaqmxd2ezn1kncmpgfqcpiz.htm
Note that the link you used is for FORMATS, to display values, not read them. Just needed to go down the page a bit further but experience is what lets some of us recognize when you need one of the E8601 or B8601 type informats.
That T means you need a quite different informat:
data example; x='2018-04-19T06:16'; dt = input(x,e8601dt.); format dt datetime.; run;
https://documentation.sas.com/doc/en/vdmmlcdc/1.0/leforinforref/p0jd9jaqmxd2ezn1kncmpgfqcpiz.htm
Note that the link you used is for FORMATS, to display values, not read them. Just needed to go down the page a bit further but experience is what lets some of us recognize when you need one of the E8601 or B8601 type informats.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.