code issue
Posted: Tue Apr 29, 2014 10:08 am
Dear All,
I do not understand why I have an error from the following code:
----------------------------------------------------
all 100
com size = 100
com sigu=1; com k =2
com dxa = sigu*%ranmat(size,k); *dis dxa
com x = %zeros(size,k); *dis x
do aa=1, size
com dxaa = %xsubmat(dxa,1,aa,1,k)
com dxaa1 = %sumc(dxaa); dis dxaa1
do kk = 1, k
com x(aa,kk) = %xcol(dxaa1,kk)
end do kk
end do aa
---------------------------------------------------
What I want to do is making a DGP which includes:
1) a random matrix of dx
2) a matrix of x which is defined as a cumulative sum of dx.
When I print dxaa1, it gives two numbers, like
-0.23
0.11
If it is for aa==1, x needs to show
-0.23 0.11
0.00 0.00
0.00 0.00
. .
. .
Finally, after all the do loop, zero values in x should be changed cumulative column sum of dx.
What could be my mistake in this code?
Thank you.
I do not understand why I have an error from the following code:
----------------------------------------------------
all 100
com size = 100
com sigu=1; com k =2
com dxa = sigu*%ranmat(size,k); *dis dxa
com x = %zeros(size,k); *dis x
do aa=1, size
com dxaa = %xsubmat(dxa,1,aa,1,k)
com dxaa1 = %sumc(dxaa); dis dxaa1
do kk = 1, k
com x(aa,kk) = %xcol(dxaa1,kk)
end do kk
end do aa
---------------------------------------------------
What I want to do is making a DGP which includes:
1) a random matrix of dx
2) a matrix of x which is defined as a cumulative sum of dx.
When I print dxaa1, it gives two numbers, like
-0.23
0.11
If it is for aa==1, x needs to show
-0.23 0.11
0.00 0.00
0.00 0.00
. .
. .
Finally, after all the do loop, zero values in x should be changed cumulative column sum of dx.
What could be my mistake in this code?
Thank you.