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 get matching results in combination?Dear all, here is the code: Code: tempfile using * Example generated by -dataex-. To install: ssc …
Reporting an error with assumptions revision after VECM trend estimation.Greetings. I want to report an issue I've discover when estimating a VECM model with trend option, l…
bugs for reclink?Dear all, Please run the code below, it says something was wrong, how to fix this? Code: tempfile …
How do I extract month and year data from combined variables?Hi, I have 51 state name variables(long data) and income data (e.g.starting from inc_JAN_1996, inc_F…
Super simple syntax questionI have a variable that contains totals of advertising costs for different products from different ye…
Subscribe to:
Post Comments (Atom)
0 Response to Compute returns based on lag variable
Post a Comment