BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Arun_shSAS
Fluorite | Level 6

Hi Guys, 

 

I have "2018-10-01 00:00:00:00" as char value and I want to convert it into sas datetime value through proc sql .. please help me out.

 

Thanks, 

Arun 

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

please try the anydtdtm format

 

data have;
x='2018-10-01 00:00:00:00';
y=input(x,anydtdtm.);
format y datetime20.;
run;
Thanks,
Jag

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

Hello @Arun_shSAS 

 

Will this help?

 

proc sql;
select *,input(char,ymddttm19.) as sas_datetime format=datetime20.
from your_input;
quit;

This assumes you have a char datetime variable in your input dataset

Arun_shSAS
Fluorite | Level 6

proc sql;
select *,input(my_time,anydtdtm.) as sas_datetime format=datetime20.
from temp;
quit;

Jagadishkatam
Amethyst | Level 16

please try the anydtdtm format

 

data have;
x='2018-10-01 00:00:00:00';
y=input(x,anydtdtm.);
format y datetime20.;
run;
Thanks,
Jag