The B8601DT informat should be able to do that. Just stick the letter T between the data and time strings.
data test;
date='20110423';
time='0015';
datetime=input(catx('T',date,time),b8601dt.);
format datetime datetime20.;
run;
data want;
d="20110423";
d1=input(d,yymmdd10.);
t="0015";
t1=input(substr(t,1,2)||':'||substr(t,3),hhmmss.);
datetime=dhms(d1,0,0,0)+t1;
format datetime datetime20.;
drop d1 t1;
run;
The B8601DT informat should be able to do that. Just stick the letter T between the data and time strings.
data test;
date='20110423';
time='0015';
datetime=input(catx('T',date,time),b8601dt.);
format datetime datetime20.;
run;
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.