Hi All,

I have date variable in this format (M/D/Y). I want to change it to a numeric format like 17964. I have tried to run the following command
Code:
format %tdDD/NN/CCYY date
Stata output is as follows
HTML Code:
string %fmt required for string variables
r(120);
I tried solve the problem by generating a new variable as suggested in many threads in this forum.
HTML Code:
gen ndate = daily( date , "DMY") 
(1,740 missing values generated)
I don't know why many values turn into missing in the new created variable

HTML Code:
code    date    ndate
1    7/21/2009    
2    7/22/2009    
3    7/23/2009    
4    7/24/2009    
5    7/27/2009    
6    7/28/2009    
7    7/29/2009    
8    7/30/2009    
9    7/31/2009    
10    8/3/2009    17964
11    8/4/2009    17995
12    8/5/2009    18025
13    8/6/2009    18056
14    8/7/2009    18086
15    8/10/2009   18178
16    8/11/2009   18209
17    8/12/2009   18239
18    8/13/2009    
19    8/14/2009    
20    8/17/2009    
21    8/18/2009    
22    8/19/2009    
23    8/20/2009    
24    8/21/2009    
25    8/24/2009    
26    8/25/2009    
27    8/26/2009    
28    8/27/2009    
29    8/28/2009    
30    8/31/2009    
31    9/1/2009    17906
32    9/2/2009    17937
Any help will be much appreciated.