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
xtprobit margin problemHello to All Stata Users! HTML Code: xtoprobit y x z, vce(cluster id) is the model I run . However…
Using reghdfe command with if-statementsHello, bit of a complex one here: I’m currently working as a research assistant, using my superviso…
Impact of an average change on dependent variable over timeHello! For my thesis I wanted to test a hypothesis which requires a model that I wouldn't know how t…
Interpretation Interactionterm in fixed effect regressionDear all , I have performed a fixed effect regression with cluster(id) xreg y i.FFF i.young FFF#yo…
merging datasets with different dimensionsHi all, I would like to merge together 16 datasets which are defined by country and are made as fol…
Subscribe to:
Post Comments (Atom)
0 Response to Compute returns based on lag variable
Post a Comment