I'm trying to use if command in loop procedure. But I got the message " 'if' found where almost anything else expected" whenever I use if- command .
The code that I wrote is presented below.
kmat=J(10,3,1)
N=rows(kmat)
for (i=1; i<=N;i++) {
tmp1=0
for (j=1; j<=N; j+++ {
if ([j]!=[i]) {
tmp1 = tmp1 + (2*Kmat[i,j])
}
}
}
And I got the error message('if' found where almost anything else expected") when if command is presented.
What's the wrong with this code?
The code that I wrote is presented below.
kmat=J(10,3,1)
N=rows(kmat)
for (i=1; i<=N;i++) {
tmp1=0
for (j=1; j<=N; j+++ {
if ([j]!=[i]) {
tmp1 = tmp1 + (2*Kmat[i,j])
}
}
}
And I got the error message('if' found where almost anything else expected") when if command is presented.
What's the wrong with this code?
Comment