I don't think it works using the SAS code above. Please see the following SAS code.
The hospitalization date is characteristic variable in the data set a as HOSPADMIT, such as '19991103'.
It means in the year '1999', 'NOV.', and date '03' The hospitalization date should be transferred to '03NOV1999'
in the data set b as variable of HOSP_ADMIT_DT.
Please try it.
Data b;
Set a;
HOSP_ADMIT_YYYY = substr(HOSPADMIT, 1,4);
HOSP_ADMIT_MM = substr(HOSPADMIT, 5,2);
HOSP_ADMIT_DD = substr(HOSPADMIT, 7,2);
HOSP_ADMIT_DT = MDY(HOSP_ADMIT_MM, HOSP_ADMIT_DD, HOSP_ADMIT_YYYY);
format HOSP_ADMIT_DT date9.;
DROP HOSPADMIT HOSP_ADMIT_YYYY HOSP_ADMIT_MM HOSP_ADMIT_DD;
Run;
[此贴子已经被作者于2008-10-25 1:05:20编辑过]