I am studying from the STATA guide.
I typed MATA and then copied and entered the following command as shown in the entry for STATA:
: real matrix id(real scalar n)
{
real scalar i
real matrix res
res = J(n, n, 0)
for (i=1; i<=n; i++) {
res[i,i] = 1
}
return(res)
}
:
: I3 = id(3)
: I3
Which gives the error: nothing found where 'while' expected
r(3000);
Any help is much appreciated.
I typed MATA and then copied and entered the following command as shown in the entry for STATA:
: real matrix id(real scalar n)
{
real scalar i
real matrix res
res = J(n, n, 0)
for (i=1; i<=n; i++) {
res[i,i] = 1
}
return(res)
}
:
: I3 = id(3)
: I3
Which gives the error: nothing found where 'while' expected
r(3000);
Any help is much appreciated.
Comment