我的Stata数据集看起来像在此处输入图像描述
我想从这个变量中删除日期,因为Stata无法将其格式化为日期用于我的时间序列。
. clear
. set obs 1
number of observations (_N) was 0, now 1
. gen problem = "Tuesday. February 1, 2000"
. gen solution = subinstr(problem, word(problem, 1), "", .)
. l
+-----------------------------------------------+
| problem solution |
|-----------------------------------------------|
1. | Tuesday. February 1, 2000 February 1, 2000 |
+-----------------------------------------------+
. gen wanted = daily(solution, "MDY")
. format wanted %td
. l
+-----------------------------------------------------------+
| problem solution wanted |
|-----------------------------------------------------------|
1. | Tuesday. February 1, 2000 February 1, 2000 01feb2000 |
+-----------------------------------------------------------+