The GAUSS code below is giving me the error G0156: Illegal redefinition of procedure 'idx'
.
How can I fix it?
new;
// law of large numbers
nnn = 10;
xxx = rndn(nnn,1);
mmm = zeros(nnn,1)
idx = zeros(nnn,1);
iii = 1;
do until iii > nnn;
idx[iii,1] = iii;
mmm[iii,1] = meanc(xxx[1:iii,1]);
iii = iii + 1;
endo;
print idx~mmm;
1 Answer
0
Short answer: the line assigning to mmm
is missing the semi-colon at the end.
Explanation
The problem is that the line:
mmm = zeros(nnn,1)
does not end with a semi-colon. Since GAUSS statements do not end until there is a semi-colon, the statement that was sent to GAUSS was:
mmm = zeros(nnn,1) idx = zeros(nnn,1);
That is not a legal GAUSS statement.
If you look at this code in the GAUSS editor, you see that it puts an error marker to the left of both lines which gives you a clue to look at the line that assigns to mmm
as well.
Your Answer
1 Answer
Short answer: the line assigning to mmm
is missing the semi-colon at the end.
Explanation The problem is that the line:
mmm = zeros(nnn,1)
does not end with a semi-colon. Since GAUSS statements do not end until there is a semi-colon, the statement that was sent to GAUSS was:
mmm = zeros(nnn,1) idx = zeros(nnn,1);
That is not a legal GAUSS statement.
If you look at this code in the GAUSS editor, you see that it puts an error marker to the left of both lines which gives you a clue to look at the line that assigns to mmm
as well.