|Title||Obtaining the correlation matrix|
|Author||William Gould, StataCorp|
The correlate command will report the correlation matrix of the data, but there are occasions when you need the matrix stored as a Stata matrix so you can further manipulate it. You can obtain it by typing
. matrix accum R = varlist, nocons dev . matrix R = corr(R)
The first line places the cross-product matrix of the data in R. The second line converts that to a correlation matrix.