Thank you, Rick. It works. Actually I used the two-level do-loop to get the derivatives of a symmetric matrix about its elements. I need to store them in a big matrix and later to subtract each of them to use in the other formula, which is in the other two-level do-loop. This is the only way I figured out. Any comment? My codes are as follows. start MM(nn,mat); mat=j(nn,nn*nn*(nn+1)/2,0); k=0; do j=1 to nn; deltaj=j(nn,1,0); deltaj = 1; do i=j to nn; deltai=j(nn,1,0); deltai=1; k=k+1; if i=j then mat1=deltaj*deltaj`; else mat1=deltai*deltaj`+deltaj*deltai`; cStart = (k-1)*nn + 1; *copy your codes here; cEnd = cStart + nn - 1; mat[,cStart:cEnd] = mat1; end; end; finish; run MM(3,mat); print mat; Is it true that do-loops can make an algorithm's convergence slowly? For my case, it looks I can not avoid the two-level do-loops. Right? Thanks again!
... View more