Reputation: 2159
I'm trying to import a timestamp variable from sql to sas. The variable looks like "2014-05-02 23:40:42". If I use proc import, it automatically gets converted to $25.
I hope to convert this timestamp into a date variable so I could analyze the recency. However, I couldn't successfully do it using format:
format created DATETIME19.;
(This returns an error message: ERROR 48-59: The format $DATETIME was not found or could not be loaded.)
Thanks!
Upvotes: 2
Views: 2069
Reputation: 12691
Try the anydtdtm.
informat:
data _null_;
x="2014-05-02 23:40:42";
y=input(x,anydtdtm25.);
put y= datetime25.;
run;
gives:
y=02MAY2014:23:40:42
Upvotes: 2