Dear all,
Suppose I have the following dataset:
I'd like to calculate the pairwise correlation between retn for each pair of firms (e.g., correlation between firmid 1's retn and firmid 2's retn ) and store correlation coefficients in separate variables.
Could anyone please help me with this?
Thank you very much for your help,
Vinh
Suppose I have the following dataset:
Code:
clear input str7 yq int firmid float retn 2000q1 1 0.2564 2000q2 1 0.2700 2000q3 1 0.2160 2000q4 1 0.1005 2000q1 2 0.2493 2000q2 2 0.3820 2000q3 2 0.2179 2000q4 2 0.3778 2000q1 3 0.9692 2000q2 3 0.4204 2000q3 3 0.9001 2000q4 3 0.2245 2000q1 4 0.7196 2000q2 4 0.3100 2000q3 4 0.5980 2000q4 4 0.4791 2000q1 5 0.1168 2000q2 5 0.2005 2000q3 5 0.1802 2000q4 5 0.2783 end
Could anyone please help me with this?
Thank you very much for your help,
Vinh
Comment