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
Placing text/label above and below marker in a coefplot generated plotHi everyone, I am trying to place labels both above and below markers in a plot generated by coefpl…
Separating by group in a scatterI would like to plot the mean wage with confidence standard deviations by grade and race (black v wh…
Oaxaca decomposition interpretation - pooled method and reference categoryHello, I'm using the Blinder-Oaxaca decomposition to study the wage differentials between males and…
Fill a dummy for all individuals based on the answer of only oneHello everyone, Just a quick question on dummy creation. I'm working on a household survey and I w…
Log File with Time StampI found code to have the year, month and day in the name of the log file. How can I modify it to hav…
Subscribe to:
Post Comments (Atom)
0 Response to Compute returns based on lag variable
Post a Comment