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!!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.