SAS Data Integration Studio: How to convert a char date column to num date column

StackOverflow https://stackoverflow.com/questions/21857626

  •  13-10-2022
  •  | 
  •  

سؤال

i have a table with a column which is a char type. The values are all in the format IS8601DT format '2014-02-18T16:02:00.000'. Is there a function or other simple way to convert this in any num date format?

Thanks in advance.

هل كانت مفيدة؟

المحلول

You need to use the anydtdtm32. informat with input function as shown below:

data test;
mydate_char='2014-02-18T16:02:00.000';
mydate_num=input(mydate_char, anydtdtm32.);
format mydate_num datetime22.;
run;
/*mydate_num:18FEB2014:16:02:00*/
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top