My approch is this: Please share yours. data xyz; length date1 $30.; date1= "08-June-2020";output; date1= "31-Oct-2020";output; date1= "13/August/2020"; output; date1= "02/Jan/2020" ;output; run ; data one; set xyz; array char_month(24) $20 _temporary_ ("JANUARY" "FEBRUARY" "MARCH" "APRIL" "MAY" "JUNE" "JULY" "AUGUST" "SEPTEMBER" "OCTOBER" "NOVEMBER" "DECEMBER" "JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"); array num_month (24) $20 _temporary_ ("01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" ); do j = 1 to 24 ; if strip(char_month(j)) = strip(upcase(scan (tranwrd (date1,"/","-"),2,"-"))) then cm_date=catx("-",scan (tranwrd (date1,"/","-"),3,"-"),num_month(j),scan (tranwrd (date1,"/","-"),1,"-")); end; drop j; run;
... View more