Hello statalist,
I'd like to do the following in a loop (jj is defined earlier as a scalar and is an integer under 50, ADDV is a 1326 by 50 matrix but I only want to subtract column j, kk is a vector with one column and number of rows jj):
for(j = 1; j <= jj; j++) {
maxindex(v,1,ww=.,null=.)
kk[j]=lookupcol[ww]
kk[jj-j]=lookuprow[ww]
v=v-ADDV[.,j]
}
This returns "<istmt>: 3301 subscript invalid" I assume due to the v replacement. I want each iteration to keep subtracting the next vector from the current v vector, thus keeping v updated through the loop.
Intention of doing this is to remove the vector of values associated with the first maximum index value. I can't just do the second max because there are a vector of values associated with a certain maximum that I want to remove before calculating the next maximum.
Anyone have a way of doing this?
Thanks.
Neal
I'd like to do the following in a loop (jj is defined earlier as a scalar and is an integer under 50, ADDV is a 1326 by 50 matrix but I only want to subtract column j, kk is a vector with one column and number of rows jj):
for(j = 1; j <= jj; j++) {
maxindex(v,1,ww=.,null=.)
kk[j]=lookupcol[ww]
kk[jj-j]=lookuprow[ww]
v=v-ADDV[.,j]
}
This returns "<istmt>: 3301 subscript invalid" I assume due to the v replacement. I want each iteration to keep subtracting the next vector from the current v vector, thus keeping v updated through the loop.
Intention of doing this is to remove the vector of values associated with the first maximum index value. I can't just do the second max because there are a vector of values associated with a certain maximum that I want to remove before calculating the next maximum.
Anyone have a way of doing this?
Thanks.
Neal
Comment