<?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 Re: Invalid DO loop control information in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716659#M221527</link>
    <description>&lt;P&gt;good catch.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2021 20:53:51 GMT</pubDate>
    <dc:creator>PhilC</dc:creator>
    <dc:date>2021-02-03T20:53:51Z</dc:date>
    <item>
      <title>Invalid DO loop control information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716635#M221513</link>
      <description>&lt;P&gt;Hi everyone, I just updated from SAS EG 8.2 to 8.3 this morning, the code worked yesterday now announce an error as below.&lt;/P&gt;
&lt;P&gt;This code is for running the same code through all files in one folder&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mydir 'C:\Users\pnguyen\OneDrive -University\PhD JOURNEY\filtering';
data _null_;
did = dopen('mydir');
do i = 1 to dnum(did);
  fname = scan(dread(did,i),1,'.');
  /*fname= ARGENTINA_FILTERF*/
  length short_fn $29;
  short_fn= substr(fname, 1,length(fname)-8);
  /*short_fn=ARGENTINA*/

  cmd=cats('%variablescalculation(File=C:\Users\pnguyen\OneDrive - University\PhD JOURNEY\filtering\',
      strip(fname),',outf=',short_fn,');');
  call execute(cmd);
end;
keep fname;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the log is as below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;240        /*Replicate all files in one folder*/
241        
242        filename mydir 'C:\Users\pnguyen\OneDrive - University\PhD JOURNEY\filtering';
243        data _null_;
244        did = dopen('mydir');
245        do i = 1 to dnum(did);
246          fname = scan(dread(did,i),1,'.');
247          /*At this point I assign that the filename has the tail is xlsx or sas7bdat, if not, use another way
248          fname= ARGENTINA_FILTERF*/
249          length short_fn $29;
250          short_fn= substr(fname, 1,length(fname)-8);
251          /*short_fn=ARGENTINA*/
252        
253          cmd=cats('%variablescalculation(File=C:\Users\pnguyen\OneDrive - University\PhD JOURNEY\filtering\',
254              strip(fname),',outf=',short_fn,');');
255          call execute(cmd);
256        end;
257        keep fname;
258        run;

NOTE: Argument 1 to function DNUM(0) at line 245 column 13 is invalid.
ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero, 
       or invalid.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you please help me to sort it out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks and warm regards.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 20:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716635#M221513</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-03T20:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid DO loop control information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716643#M221517</link>
      <description>&lt;P&gt;I would be interested in seeing the return values of your functions in your code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;dopen('mydir');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;dnum(did);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I would think it would inform us whilst debugging.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 20:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716643#M221517</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-02-03T20:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid DO loop control information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716651#M221523</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15329"&gt;@PhilC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code stop there. And the returns logically speaking are&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;did = dopen('mydir');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is a code to open the directory&amp;nbsp;'C:\Users\pnguyen\OneDrive - University\PhD JOURNEY\filtering'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dnum(did);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is to retrieve the number of file in this directory, in particular, in my case, I have 64 files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 20:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716651#M221523</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-03T20:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid DO loop control information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716652#M221524</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15329"&gt;@PhilC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I would be interested in seeing the return values of your functions in your code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;dopen('mydir');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;dnum(did);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I would think it would inform us whilst debugging.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think it did. DNUM(0) in the message tells me that DOPEN failed. Or did you mean all the variables as dumped when other Invalid data is encountered?&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-details"&gt;
&lt;DIV id="p0lionffn2rkawn1f4bc5hps89wj" class="xis-topicContent"&gt;
&lt;DIV id="n0em8pqoiydsaln1gmw02b9fe97y" class="xis-paragraph"&gt;If the directory cannot be opened, &lt;FONT style="background-color: #fcdec0;"&gt;DOPEN&lt;/FONT&gt; returns 0, and you can obtain the error message by calling the SYSMSG function.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp; Check the spelling on your path. In another post you have&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;libname myfolder 'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\3calculation1';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and this post does not include the "Massey" part of the path in the libname statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might also suggest having your libnames names mean something like Libname Calc for the one immediately above and Libname Filter instead of constantly renaming "myfolder" and never knowing which actual files are there.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 20:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716652#M221524</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-03T20:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid DO loop control information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716659#M221527</link>
      <description>&lt;P&gt;good catch.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 20:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-DO-loop-control-information/m-p/716659#M221527</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-02-03T20:53:51Z</dc:date>
    </item>
  </channel>
</rss>

