Hi All, Trying to convert the dates. Kindly help data a_; input date $20.; datalines ; 2020-10-20 2020-10 2020 ; run; data b_; format dtn yymmdd10.; set a_; if length(date) = 10 then do; dtn=input(date,yymmdd10.); end; if length(date) = 7 then do; dtn=input(compress(date,'-'),yymmn6.); end; run; output: dtn date 2020-10-20 2020-10-20 2020-10-01 2020-10 Desired output: dtn date 2020-10-20 2020-10-20 2020-10 2020-10 Due to format applied,01 is added.
... View more