Dear Statalisters,
I have panel data and want to compute a time series of cross-sectional correlations of two variables, x1 and x2.
So far, my approach has been:
However, the corr() command from egenmore does not allow weights. I am struggling to find an efficient work around...
Any suggestions are highly appreciated!
Best,
John
I have panel data and want to compute a time series of cross-sectional correlations of two variables, x1 and x2.
So far, my approach has been:
Code:
bysort year: egen correlation = corr(x1 x2)
Any suggestions are highly appreciated!
Best,
John
Comment