Dear all,
I have the following weekly panel dataset:
Where there are 7 days between observations within the same panel.
I try to define my dataset panel using:
And get a float variable for date2 as a result.
I can perfectly run regressions such as:
However when I run a time-series regression such as
I get the following error code: "time variable must contain only integer values r(451)"
So I created a new variable:
But the results are the same and I am really not sure what is the problem.
Furhtermore the "count if !missing" command shows that all my observations are missing, however this is quite strange given I can run non-time-series regression.
Any help would be really appreciated!
Many thanks in advance!
I have the following weekly panel dataset:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str10 date byte id float(mean_return_weekly case_key_market_return_weekly date2) "2015-01-23" 0 .0041432767 -.064748704 20111 "2017-04-14" 0 -.19679497 -.018455634 20923 "2014-03-10" 1 .07127273 .02030232 19792 "2018-06-25" 1 .05313396 -.04045292 21360 "2014-03-29" 2 .09463324 .05680729 19811 "2015-01-17" 2 .07829325 -.05228545 20105 "2018-03-17" 2 -.014469092 -.014861934 21260 "2019-03-23" 3 .018260526 -.026457224 21631 "2017-10-28" 4 .08790786 -.016547952 21120 "2018-02-17" 4 -.028749533 .01312601 21232 "2015-07-05" 5 .008704542 -.0007317966 20274 "2014-08-31" 6 .069394946 .0502498 19966 "2018-05-06" 6 .005442227 .0015735645 21310 "2020-02-09" 6 -.0023563064 .02675025 21954 "2016-01-07" 9 .032150116 .02361343 20460 "2016-05-12" 9 .0017465983 -.03200009 20586 "2017-03-16" 9 -.03948626 -.02414604 20894 "2021-08-19" 9 .011072878 -.07161644 22511 "2018-10-04" 10 -.02794765 -.006522959 21461 "2018-06-24" 12 -.09037378 -.04516252 21359 "2019-08-18" 15 -.011371915 .020680206 21779 "2017-12-15" 16 .019289013 -.0007621952 21168 "2017-09-30" 18 .03859815 -.04091068 21092 "2020-06-06" 18 .008079143 .16526787 22072 "2019-03-10" 20 -.03274173 .00966191 21618 "2019-09-22" 20 .015375464 -.0088528795 21814 "2021-05-16" 20 -.02298662 .0746131 22416 "2020-10-22" 21 -.07719935 .04579298 22210 "2021-07-11" 25 -.04076784 -.0038614746 22472 "2021-06-25" 28 -.09694575 -.02367404 22456 end
Where there are 7 days between observations within the same panel.
I try to define my dataset panel using:
Code:
generate date2 = date(date,"YMD") xtset id date2, delta(7)
I can perfectly run regressions such as:
Code:
regress mean_return_weekly case_key_market_return_weekly if id == 1 xtreg case_key_market_return_weekly mean_return_weekly, re
Code:
arima mean_return_weekly if id== 0, ar(1)
So I created a new variable:
Code:
gen int date3 = date2
Furhtermore the "count if !missing" command shows that all my observations are missing, however this is quite strange given I can run non-time-series regression.
Any help would be really appreciated!
Many thanks in advance!
Comment