Hi All,
I have date variable in this format (M/D/Y).
I want to change it to a numeric format like 13149.
I have tried to run the following command and STATA output is as follows.
. gen stdate=mdy(stmo, stdy, styr)
(4 missing values generated)
. list styr stmo stdy xityr xitmo xitdy if stdate==.
+---------------------------------------------+
| styr stmo stdy xityr xitmo xitdy |
|---------------------------------------------|
4789. | 1974 2 29 2018 12 31 |
44691. | 1997 2 29 2013 1 23 |
46976. | 1998 2 29 2018 12 31 |
65341. | 2001 2 29 2018 12 31 |
+---------------------------------------------+
. gen pd=xitdat-stdate
(4 missing values generated)
. gen py=pd/365.25
(4 missing values generated)
I tried solve the problem by generating a new variable as suggested in many threads in this forum.
I don't know why four values turn into missing in the new created variable.
Is anybody here who can help me with this issue?
Thank you for your time and insights.
Ye Jin Bang
I have date variable in this format (M/D/Y).
I want to change it to a numeric format like 13149.
I have tried to run the following command and STATA output is as follows.
. gen stdate=mdy(stmo, stdy, styr)
(4 missing values generated)
. list styr stmo stdy xityr xitmo xitdy if stdate==.
+---------------------------------------------+
| styr stmo stdy xityr xitmo xitdy |
|---------------------------------------------|
4789. | 1974 2 29 2018 12 31 |
44691. | 1997 2 29 2013 1 23 |
46976. | 1998 2 29 2018 12 31 |
65341. | 2001 2 29 2018 12 31 |
+---------------------------------------------+
. gen pd=xitdat-stdate
(4 missing values generated)
. gen py=pd/365.25
(4 missing values generated)
I tried solve the problem by generating a new variable as suggested in many threads in this forum.
I don't know why four values turn into missing in the new created variable.
Is anybody here who can help me with this issue?
Thank you for your time and insights.
Ye Jin Bang

Comment