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!!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.