在stata中有变量名date,如2007-12-31,2008-12-31,查看数据类型为%10s,怎样转化为日期型类型。
我试了 gen x=date(date,"YMD"),format x %td。
但x均为缺失值?为什么?怎么处理?非常感谢!
另外我还试了一下这种方法发现还是不行:gen datenew=date(substr(date, 1,4))+substr(date,6,2)+substr(date, 9,2), "MDY")
format datenew %td.


雷达卡






京公网安备 11010802022788号







