I am converting string to date variable running the following code:
Code:
gen date2 = date(date, "MDY") format date2 %td
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 date float date2 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/12/2011" 18962 "01/13/2011" . "01/13/2011" . "01/13/2011" . "01/13/2011" . "01/13/2011" . "01/13/2011" . "01/13/2011" . "01/13/2011" . end
Stata, however, converts some to dates but generates missing value for the others.
Any idea of how to fix it?
Thanks.
0 Response to convert string to date: some observations are missing values
Post a Comment