proc iml; start corr_mat(corr,p);/*p is the number of variables which is the dimension of the objective p*p correlation matrix*/
/*corr is the vector containing all nontrivial correlations in order*/
w=p:2; v=(1||cusum(w)+1); do i=1 to ncol(v); s=v[i]; corr=insert(corr,1,0,s); end; corr_mat=sqrvech(corr); return(corr_mat); finish; quit;
Thank you Rick! Would the above code also works? Suppose we know how many variables we want, say p=7 variables, and we have the correlation vectors. Do you think this solution is correct?
... View more