Dear Statafriends,
Upfront apologies if this question has been asked before.
I want to know how to calculate correlations within a variable by group. My data is set as panel data and I am interested what the correlations are for a single variable per group.
This code does not work. Then I'll get the correlation of the variable by group on itself.
To clarify, I would like to get this result for my Amihud-variable:
Hopefully one of you could help me on my way. Many thanks in advance!
Upfront apologies if this question has been asked before.
I want to know how to calculate correlations within a variable by group. My data is set as panel data and I am interested what the correlations are for a single variable per group.
Code:
by sick, sort: correlate amihud
To clarify, I would like to get this result for my Amihud-variable:
SICCD | 1311 | 5432 | 7011 | etc.. |
1311 | [corr] | [corr] | [corr] | [corr] |
5432 | [corr] | [corr] | [corr] | [corr] |
etc.. | [corr] | [corr] | [corr] | [corr] |
Hopefully one of you could help me on my way. Many thanks in advance!
Comment