<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAS error: The %DO statement is not valid in open code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-error-The-DO-statement-is-not-valid-in-open-code/m-p/634655#M188382</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to implementing a treeboost procedure for my dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;modevals is the dataset that consists of the variables that I want to use for the treeboost.&lt;/P&gt;&lt;P&gt;ParamList consists of the list of variable names.&lt;/P&gt;&lt;P&gt;I am getting the error "The %DO statement is not valid in open code" when I run the below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC TREEBOOST data=modelvals&lt;BR /&gt;CATEGORICALBINS=6&lt;BR /&gt;INTERVALBINS=20&lt;BR /&gt;EXHAUSTIVE=100&lt;BR /&gt;INTERVALDECIMALS= MAX&lt;BR /&gt;MAXDEPTH = 3&lt;BR /&gt;MAXBRANCH = 5&lt;BR /&gt;leafsize=15&lt;BR /&gt;Iterations=2000&lt;BR /&gt;Mincatsize=10&lt;BR /&gt;seed=n&lt;BR /&gt;TRAINPROPORTION = 0.5&lt;BR /&gt;SHRINKAGE=0.1&lt;BR /&gt;SPLITSIZE=30;&lt;/P&gt;&lt;P&gt;%let i = 1;&lt;BR /&gt;%let token = %scan(&amp;amp;ParamList,&amp;amp;i);&lt;/P&gt;&lt;P&gt;%do %while(%length(&amp;amp;token));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INPUT &amp;amp;TOKEN/MISSING=BIGBRANCH MAXBRANCHES=2;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %let i = %eval(&amp;amp;i+1);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %let token = %scan(&amp;amp;ParamList,&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;Target TARGET_VARIABLE /level=binary;&lt;BR /&gt;SUBSERIES LONGEST;&lt;BR /&gt;SAVE FIT=X._fit MODEL=ABC.X._mdl RULES=ABC.X._rul nodestats=ABC.X._nod IMPORTANCE=imp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bond&lt;/P&gt;</description>
    <pubDate>Wed, 25 Mar 2020 09:43:48 GMT</pubDate>
    <dc:creator>Bond007</dc:creator>
    <dc:date>2020-03-25T09:43:48Z</dc:date>
    <item>
      <title>SAS error: The %DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-error-The-DO-statement-is-not-valid-in-open-code/m-p/634655#M188382</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to implementing a treeboost procedure for my dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;modevals is the dataset that consists of the variables that I want to use for the treeboost.&lt;/P&gt;&lt;P&gt;ParamList consists of the list of variable names.&lt;/P&gt;&lt;P&gt;I am getting the error "The %DO statement is not valid in open code" when I run the below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC TREEBOOST data=modelvals&lt;BR /&gt;CATEGORICALBINS=6&lt;BR /&gt;INTERVALBINS=20&lt;BR /&gt;EXHAUSTIVE=100&lt;BR /&gt;INTERVALDECIMALS= MAX&lt;BR /&gt;MAXDEPTH = 3&lt;BR /&gt;MAXBRANCH = 5&lt;BR /&gt;leafsize=15&lt;BR /&gt;Iterations=2000&lt;BR /&gt;Mincatsize=10&lt;BR /&gt;seed=n&lt;BR /&gt;TRAINPROPORTION = 0.5&lt;BR /&gt;SHRINKAGE=0.1&lt;BR /&gt;SPLITSIZE=30;&lt;/P&gt;&lt;P&gt;%let i = 1;&lt;BR /&gt;%let token = %scan(&amp;amp;ParamList,&amp;amp;i);&lt;/P&gt;&lt;P&gt;%do %while(%length(&amp;amp;token));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INPUT &amp;amp;TOKEN/MISSING=BIGBRANCH MAXBRANCHES=2;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %let i = %eval(&amp;amp;i+1);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %let token = %scan(&amp;amp;ParamList,&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;Target TARGET_VARIABLE /level=binary;&lt;BR /&gt;SUBSERIES LONGEST;&lt;BR /&gt;SAVE FIT=X._fit MODEL=ABC.X._mdl RULES=ABC.X._rul nodestats=ABC.X._nod IMPORTANCE=imp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bond&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 09:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-error-The-DO-statement-is-not-valid-in-open-code/m-p/634655#M188382</guid>
      <dc:creator>Bond007</dc:creator>
      <dc:date>2020-03-25T09:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS error: The %DO statement is not valid in open code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-error-The-DO-statement-is-not-valid-in-open-code/m-p/634661#M188385</link>
      <description>&lt;P&gt;%do %while is only allowed in a macro. You need to create a macro and execute it (partial code):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SPLITSIZE=30;
%macro mymac;
%let i = 1;
%let token = %scan(&amp;amp;ParamList,&amp;amp;i);
%do %while(%length(&amp;amp;token));
          INPUT &amp;amp;TOKEN/MISSING=BIGBRANCH MAXBRANCHES=2;
          %let i = %eval(&amp;amp;i+1);
          %let token = %scan(&amp;amp;ParamList,&amp;amp;i);
%end;
%mend;
%mymac
Target TARGET_VARIABLE /level=binary;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Mar 2020 09:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-error-The-DO-statement-is-not-valid-in-open-code/m-p/634661#M188385</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-25T09:59:41Z</dc:date>
    </item>
  </channel>
</rss>

