<?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: do until eof with an empty dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425229#M104729</link>
    <description>&lt;P&gt;Trying to read from an empty dataset immediately throws you to the end of the data step, bypassing all remaining statements.&lt;/P&gt;
&lt;P&gt;Compare this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
put 'before';
set empty_class;
put 'after';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jan 2018 14:15:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-01-05T14:15:28Z</dc:date>
    <item>
      <title>do until eof with an empty dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425224#M104728</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following program :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data empty_class;
    set sashelp.class;
    stop;
run;

data _NULL_;
    put "1";

    eof=0;
    do until (eof);
        set sashelp.class end=eof;
        put name;
    end;

    put "2";

    eof=0;
    do until (eof);
        set empty_class end=eof;
        put name;
    end;

    put "3";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;gives the following output in the log :&lt;/P&gt;
&lt;PRE&gt;1
Alfred
Alice
Barbara
Carol
Henry
James
Jane
Janet
Jeffrey
John
Joyce
Judy
Louise
Mary
Philip
Robert
Ronald
Thomas
William
2
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: There were 0 observations read from the data set WORK.EMPTY_CLASS.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;Why is "3" not displayed and how can it be fixed ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 13:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425224#M104728</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-01-05T13:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: do until eof with an empty dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425229#M104729</link>
      <description>&lt;P&gt;Trying to read from an empty dataset immediately throws you to the end of the data step, bypassing all remaining statements.&lt;/P&gt;
&lt;P&gt;Compare this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
put 'before';
set empty_class;
put 'after';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 14:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425229#M104729</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-05T14:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: do until eof with an empty dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425230#M104730</link>
      <description>&lt;P&gt;Because the&amp;nbsp;&lt;SPAN&gt;SET statement ends the DATA step because there are no observations to read in your second do until loop&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 14:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425230#M104730</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-05T14:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: do until eof with an empty dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425234#M104731</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;I thought the set on sashelp.class would avoid early termination.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 14:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-until-eof-with-an-empty-dataset/m-p/425234#M104731</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-01-05T14:18:14Z</dc:date>
    </item>
  </channel>
</rss>

