Hi,
I have a dataset which has admissiondate: 11APR20:23:49:00 (numeric)
Another dateset which has admissiondate: 2020-04-11 23:49:00 ( character)
I want to merge these two datasets.
Can you help me in this? to change character to numeric and change the formats?
thank you in advance.
Hi @Smitha9
You should first convert the character date in dataset2 into a valid sas datetime (numeric).
To do that you can do this;
data dataset2_bis;
set dataset2;
date2 = input ("2020-04-11 23:49:00",anydtdtm.);
format date2 datetime20.;
run;
Best,
Hi @Smitha9
You should first convert the character date in dataset2 into a valid sas datetime (numeric).
To do that you can do this;
data dataset2_bis;
set dataset2;
date2 = input ("2020-04-11 23:49:00",anydtdtm.);
format date2 datetime20.;
run;
Best,
SAS provides an informat that can read this datetime value:
data test;
instring = "2020-04-11 23:49:00";
dt = input(instring,e8601dt19.);
format dt datetime19.;
run;
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.