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
Sample Selection Issue: Pooled Cross Sectional DataHi All, I am using micro level dependent and country level independent variable. Just for example, …
[putdocx] Using if command to remove blank lineHello, I am making a lot of news report with putdocx command in Stata. I will collect various news …
Bootstrap with xtabond2Hello everyone, I am a beginner researcher. Now, I try my data with xtabond2 command. I see almost e…
R200 error ologit categorical dependent and independent variablesHi all, I am really struggling with identifying the predictors of a 5 category variable Excellent to…
Omitted coefficients using reghdfeHello, I am estimating regressions that include different fixed effects and variables whose coeffic…
Subscribe to:
Post Comments (Atom)
0 Response to Compute returns based on lag variable
Post a Comment