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 split a var(string) into two vars hello, I have a question, how to sArray plit a into two as required: ----------------------- c…
Randomly shuffling only one variable in StataHello, We are trying to run a placebo test for our model and to do that we wish to randomly shuffle…
Running regression each country/year using GMM with xtabond2 Dear Statalist, I want to estimate using GMM predicted Y value for each year and each country in a…
Confidence Interval for Sensitivity and SpecificityI have the following data and would like to calculate the confidence interval for the sensitivity an…
Please delete - double postingPosted twice by mistake, sorry …
Subscribe to:
Post Comments (Atom)
0 Response to Compute returns based on lag variable
Post a Comment