本人已经解决,使用了笨办法,供大家参考批评!
deadline 即为所处理的时间变量
******时期变量处理
replace deadline = lower(deadline)
split deadline, parse("-") gen(ndate) notrim
rename ndate1 date
rename ndate2 month
rename ndate3 year
*****月份为英文缩写处理方法*******************
replace month = subinstr(month, "jan", "01",.)
replace month = subinstr(month, "feb", "02",.)
replace month = subinstr(month, "mar", "03",.)
replace month = subinstr(month, "apr", "04",.)
replace month = subinstr(month, "may", "05",.)
replace month = subinstr(month, "jun", "06",.)
replace month = subinstr(month, "jul", "07",.)
replace month = subinstr(month, "aug", "08",.)
replace month = subinstr(month, "sep", "09",.)
replace month = subinstr(month, "oct", "10",.)
replace month = subinstr(month, "nov", "11",.)
replace month = subinstr(month, "dec", "12",.)
**********************************************
*****将year格式补充完整
replace year = "20" + year
destring date month year, replace
gen deadlineymd = mdy(month, date, year)
gen deadlineym = ym(year, month)
format deadlineym %tm
附件列表