I dont know if there is any very easy way to do this. I do it manually by simulate vectors with independent entries with a variance equal to the eigenvalues. Then the linear transformation obtained by multiply the matrix with eigenvectors on that result in a vector with the wanted covariance. *I will need to do some matrix operations, so I use option cmplib to point on the place where I have put these. See my post about that here https://communities.sas.com/ideas/1570 option cmplib=(work.func); data corr; input c1-c8; cards; 1 0.00885217 -0.088563853 0.170315918 -0.14616131 -0.019573222 -0.092562819 -0.160620889 0.00885217 1 -0.059626568 0.035719892 0.01249655 0.011717493 0.073782848 0.018419863 -0.088563853 -0.059626568 1 0.04983739 0.050539605 -0.030848973 0.081274999 -0.016919634 0.170315918 0.035719892 0.04983739 1 -0.155494382 -0.286070226 -0.171346052 -0.036586031 -0.14616131 0.01249655 0.050539605 -0.155494382 1 0.115005076 0.148470073 -0.0011815 -0.019573222 0.011717493 -0.030848973 -0.286070226 0.115005076 1 -0.10766422 0.054409451 -0.092562819 0.073782848 0.081274999 -0.171346052 0.148470073 -0.10766422 1 -0.158523541 -0.160620889 0.018419863 -0.016919634 -0.036586031 -0.0011815 0.054409451 -0.158523541 1 ; run; data simulate; set corr end=end; array c{8}; array corr{8,8} _temporary_; array eigenvec{8,8} _temporary_; array eigenval{8} _temporary_; do i=1 to 8; corr[_n_,i]=c; end; if end; *now the covariance matrix is loaded into an array; *then I find the eigenvectors and eigenvalues; call jacobi(corr,eigenval,eigenvec,nrot); array u{8,1} _temporary_; array xtemp{8,1} _temporary_; array x{8}; *Then I start simulating; do j=1 to 100000; do i=1 to 8; u[i,1]=rand('normal',0,sqrt(eigenval)); end; call multiplicer(eigenvec,u,xtemp); do i=1 to 8; x=xtemp[i,1]; end; output; end; keep x1-x8; run; proc corr data=simulate pearson; var x1-x8; run;
... View more