Dear, My data contains date variable with the following values. I am using the following code to get the output. I got the output except for a few OBS containing 'jun' as the month because I am trying to remove 'un' charcters using tranwrd function which removes 'un' in 'jun' month. Please help me simply the code. Thanks date //2011 00/UNK/UNK 01/Dec/2014 02/UNK/2014 18/jun/2008 UN/mar/2023 Un/apr/2013 uN/sep/2011 un/oct/2009 Un/UNK/2003 UN/UNK/2002 uN/UNK/2015 Un/UNK/2006 code; date1=tranwrd(date_raw,'/',''); date2=tranwrd(date1,'UNK',''); date3=tranwrd(date2,'un',''); date4=tranwrd(date3,'UN',''); date5=tranwrd(date4,'Un',''); date6=compress(tranwrd(date5,'uN','')); if length(date6)=9 then STDTC2= put(input(date6,date9.),is8601da.); if length(date6)=7 then STDTC3= put(input(date6,monyy7.),yymmd7.); if length(date6)=4 then STDTC4= put(input(date6,best.),10.); if stdtc2 ^='' then isdate=stdtc2; else if stdtc3 ^='' then isdate=stdtc3; else if stdtc4 ^='' then isdate=stdtc4; output needed; 2011 blank 2014-12-01 2014--02 2008-06-18 2023-03 2013-04 2011-09 2009-10 2003 2002 2015 2006
... View more