Do statement not valid in open code

I am trying to implementing a treeboost procedure for my dataset.

modevals is the dataset that consists of the variables that I want to use for the treeboost.

ParamList consists of the list of variable names.

I am getting the error "The %DO statement is not valid in open code" when I run the below code.

PROC TREEBOOST data=modelvals
CATEGORICALBINS=6
INTERVALBINS=20
EXHAUSTIVE=100
INTERVALDECIMALS= MAX
MAXDEPTH = 3
MAXBRANCH = 5
leafsize=15
Iterations=2000
Mincatsize=10
seed=n
TRAINPROPORTION = 0.5
SHRINKAGE=0.1
SPLITSIZE=30;

%do %while(%length(&token));
INPUT &TOKEN/MISSING=BIGBRANCH MAXBRANCHES=2;
%let i = %eval(&i+1);
%let token = %scan(&ParamList,&i);
%end;
Target TARGET_VARIABLE /level=binary;
SUBSERIES LONGEST;
SAVE FIT=X._fit MODEL=ABC.X._mdl RULES=ABC.X._rul nodestats=ABC.X._nod IMPORTANCE=imp;
run;