In reply to Rick Wicklin.

I am creating an example for an economic capital model, and am using the below code (with the above functions) to generate the matrix. Let me know if I am doing something wrong.

A = I(10); /* Allocate space for matrix */
call randgen(A,'UNIFORM'); /* Generate random numbers */
A = A + A`; /* Make matrix symmetric */
A = corr(A); /* Treat A as covariance matrix and get corr matrix */
print A;
B = NearestCorr(A); /* Find nearest pos-def corr matrix */
epsilon = 1e-10;
B2 = ProjU( B/(1+epsilon) );
print B;