import excel "G:\FactSet_Bonds_test.xlsx", sheet("Sheet6") firstrow allstring drop Name reshape long Y, i(Code) j(origdate) string rename Y yield tostring origdate, replace gen year=substr(origdate, 1, 4) gen month=substr(origdate, 5, 2) gen day=substr(origdate, 7,2) destring year, replace destring month, replace destring day, replace gen date=mdy(month, day, year) format date %td drop origdate month day year drop if mi(yield) destring yield, replace