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.
code issue
Re: code issue
It looks like you're thinking Gauss/Matlab rather than RATS. Wouldn't
set dx 1 100 = %ran(sigu)
acc dx / x
give you what you want?
Regarding your code,
com x(aa,kk) = %xcol(dxaa1,kk)
seems to be trying to push the whole column of values into a single location. What you needed there was
com x(aa,kk) = dxaa1(kk,1)
set dx 1 100 = %ran(sigu)
acc dx / x
give you what you want?
Regarding your code,
com x(aa,kk) = %xcol(dxaa1,kk)
seems to be trying to push the whole column of values into a single location. What you needed there was
com x(aa,kk) = dxaa1(kk,1)
Re: code issue
Yes, it works now. Thank you very much. 