Convert string 1997-08-22 into a date variable
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | * Convert string 1997-08-22 into a date variable. * Ray 2003/10/10. data list fixed /date1 1-10(a). begin data 1997-08-22 1998-03-31 end data. compute yr=number(substr(date1,1,4),f4). compute mo=number(substr(date1,6,2),f4). compute da=number(substr(date1,9,2),f4). compute date2=date.dmy(da,mo,yr). formats date2(adate10). execute. |
Related pages
...