When I use "break" command in the fllowing script, the variable "end" can NOT be revalued in the second loop(ii). What's a problem?
first=1; for(ref=5;ref<=20;ref+=5) { loop(ii,first,wks.maxrows) { if(%(data1,2,ii)>=ref) { end=ii-1; break; }; }; set col(2) -bs first; set col(2) -es end; sum(col(2)); type "firsti=$(first) endi=$(end) ref=$(ref) mean=$(sum.mean)"; first=end+1; };
eno
Edited by - eno on 03/07/2005 01:13:33 AM
2 L A T E S T R E P L I E S (Newest First)
eno
Posted - 03/07/2005 : 11:57:18 PM It works well. Thank you very much!
eno
Mike Buess
Posted - 03/07/2005 : 08:26:24 AM I created two worksheets, Data1 and Data2, and filled column 2 of each with row numbers. Running your script when Data2 is active gave this result which looks correct...
The second column of Data1 is used in the inner loop and when Data1 is active you are restricting the range of that column with the set -bs/-es commands in the outer loop. Your script works for both worksheets if you reset col(2) to full range...
set col(2) -bs first; set col(2) -es end; sum(col(2)); set col(2) -b 1; set col(2) -e wks.maxrows;