Hello,
Can you please help me with the following issue:
I want to form quantiles based on the credit rating (quantile_cr_monthly) at time (month) t.
At time t+1, I would like to compute the average returns (ret_eom) for the observations within the quantile formed at month t.
I tried the following command, but it returns a "not sorted" error:
I first define each monthly observation as:
gen mdate = ym(yr, month)
To compute the average returns, I tried:
bysort mdate quantile_cr_monthly: egen ptf_ret_cr_lead=mean(f.ret_eom)
Thank you for your help!
Related Posts with Compute returns based on lag variable
How to graph the moderating effect(moderator: dummy variable) of a quadratic model?Dear specialists, I really thank everyone here sparing no efforts to help me. I have a censored da…
What is the reference for excluding a covariate if there is many missing observation?Normally, I exclude a covariate out of the regression equation if there are many missing observation…
Regarding Interval data (generating more years and duplicating values)Dear, Can anyone help me to manage the data? I have interval data. Since the data are only availabl…
panel data with cross sectional dependence and autocorrelationI have a panel data with N>T (N=157, T=15). Have taken log of a few variables to make it Heterosc…
Regarding Interval data (generating more years and duplicating values)Dear, Can anyone help me to manage the data? I have interval data. Since the data are only availabl…
Subscribe to:
Post Comments (Atom)
0 Response to Compute returns based on lag variable
Post a Comment