Hi all,
I have a variable of text data type with data value looks like 'username1 17/04/28 13:34:44'.
the text string is the username and followed by the date (YY/MM/DD) and time (24 hour format).
I want to convert this variable into a datetime field looks like '28APR2017:13:34:44' of data type "datetime20." which I will use later in the program to calculate the time interval.
Thanks
HI @zimcom Will this do?
data test;
have='username1 17/04/28 13:34:44';
want=dhms(input(scan(have,2,' '),yymmdd8.),0,0,0) +
input(scan(have,-1,' '),time10.);
format want datetime20.;
run;
HI @zimcom Will this do?
data test;
have='username1 17/04/28 13:34:44';
want=dhms(input(scan(have,2,' '),yymmdd8.),0,0,0) +
input(scan(have,-1,' '),time10.);
format want datetime20.;
run;
@novinosrin Thank you so much!!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.