I am conducting a country pair wise correlation between accounting accruals (var1) and changes in operating cash flows (var2).
The contemporaneous correlation between these two variables is a measure of earnings smoothing. I use the following codes:
<1>duplicates drop year, force
<2>xtset gvkey year
<4>gen var1=accruals
<3>gen var2=d.onacf
<4>statsby "corr var1 var2" r(rho), by(loc)
I wish to use this code to capture the correlation, but it turns out that this code will delete all my observations.
The contemporaneous correlation between these two variables is a measure of earnings smoothing. I use the following codes:
<1>duplicates drop year, force
<2>xtset gvkey year
<4>gen var1=accruals
<3>gen var2=d.onacf
<4>statsby "corr var1 var2" r(rho), by(loc)
I wish to use this code to capture the correlation, but it turns out that this code will delete all my observations.
Comment