1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| data table_test1;
set table_test;
d=scan(scan(date_00, 2, " "), 1, ",");
m=upcase(scan(date_00, 1, " "));
y=scan(date_00, 3, " ");
demi_journee=scan(date_00, 5, " ");
h=scan(scan(date_00, 4, " "), 1, ":");
if demi_journee="AM" then h=scan(scan(date_00, 4, " "), 1, ":");
if demi_journee="PM" then h=h+12;
min=scan(scan(date_00, 4, " "), 2, ":");
s=scan(scan(date_00, 4, " "), 3, ":");
if m="JAN" then m="01";
if m="FEB" then m="02";
if m="MAR" then m="03";
if m="APR" then m="04";
if m="MAY" then m="05";
if m="JUN" then m="06";
if m="JUL" then m="07";
if m="AUG" then m="08";
if m="SEP" then m="09";
if m="OCT" then m="10";
if m="NOV" then m="11";
if m="DEC" then m="12";
date1=put(dhms(mdy(m, d, y),h,min,s), datetime.);
date2=put(mdy(m, d, y), ddmmyy10.);
drop d m y h min s demi_journee;
run; |
Partager