I have to do an ADF test on weekly data (T-bill from ALFRED, 1/2/1970 ~ ). To do the test I have to change the date to weekly with command:
. tsset Date, weekly
But this doens't work since I have gaps in my date according to Stata (but there no gaps). So I used:
. gen date2 = mofd(Date)
. format datum %tw
which gave me:
Date WGS10YR TBILL termsp~l date2
1. 1/2/1970 7.94 8.02 -0.08 1962w17
2. 1/9/1970 7.93 7.91 0.02 1962w17
3. 1/16/1970 7.82 7.83 -0.01 1962w17
4. 1/23/1970 7.69 7.83 -0.14 1962w17
5. 1/30/1970 7.73 7.89 -0.16 1962w17
6. 2/6/1970 7.51 7.61 -0.10 1962w18
7. 2/13/1970 7.27 7.20 0.07 1962w18
8. 2/20/1970 7.13 6.79 0.34 1962w18
9. 2/27/1970 7.01 6.88 0.13 1962w18
10. 3/6/1970 6.97 6.89 0.08 1962w19
This is obviously not right since 1/2/1970 is not week 17 in 1962. It should give me 1970w1
When I used mofd(Date) on monthly data is worked, so I could format it to %tm and us it for my ADF test. But with weekly data I get the wrong date the whole time. Right now I have the date in excel in:
nummeric form: ddmmjjjj
string form: dd-mm-jjjj
excel date form: dd/mm/jjjj
I tried everything to get it in the form: jjjj w Nr. to use it in my test. But nothing worked for me so far. Can someone please help me out with this?
Thank you
. tsset Date, weekly
But this doens't work since I have gaps in my date according to Stata (but there no gaps). So I used:
. gen date2 = mofd(Date)
. format datum %tw
which gave me:
Date WGS10YR TBILL termsp~l date2
1. 1/2/1970 7.94 8.02 -0.08 1962w17
2. 1/9/1970 7.93 7.91 0.02 1962w17
3. 1/16/1970 7.82 7.83 -0.01 1962w17
4. 1/23/1970 7.69 7.83 -0.14 1962w17
5. 1/30/1970 7.73 7.89 -0.16 1962w17
6. 2/6/1970 7.51 7.61 -0.10 1962w18
7. 2/13/1970 7.27 7.20 0.07 1962w18
8. 2/20/1970 7.13 6.79 0.34 1962w18
9. 2/27/1970 7.01 6.88 0.13 1962w18
10. 3/6/1970 6.97 6.89 0.08 1962w19
This is obviously not right since 1/2/1970 is not week 17 in 1962. It should give me 1970w1
When I used mofd(Date) on monthly data is worked, so I could format it to %tm and us it for my ADF test. But with weekly data I get the wrong date the whole time. Right now I have the date in excel in:
nummeric form: ddmmjjjj
string form: dd-mm-jjjj
excel date form: dd/mm/jjjj
I tried everything to get it in the form: jjjj w Nr. to use it in my test. But nothing worked for me so far. Can someone please help me out with this?
Thank you
Comment