<?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: end-of-file with direct access to read data. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394345#M95003</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42549"&gt;@arjunascagnetto&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the Certification book (Base) i found this question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no end-of-file condition when you use direct access to read data, so how can&lt;BR /&gt;your program prevent a continuous loop?&lt;BR /&gt;a. Do not use a POINT= variable.&lt;BR /&gt;b. Check for an invalid value of the POINT= variable.&lt;BR /&gt;c. Do not use an END= variable.&lt;BR /&gt;d. Include an OUTPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with this answer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correct answer: b&lt;BR /&gt;To avoid a continuous loop when using direct access, either include a STOP&lt;BR /&gt;statement or use programming logic that executes a STOP statement when the data&lt;BR /&gt;step encounters an invalid value of the POINT= variable. If SAS reads an invalid&lt;BR /&gt;value of the POINT= variable, it sets the automatic variable _ERROR_ to 1. You can&lt;BR /&gt;use this information to check for conditions that cause continuous looping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand the use of STOP statement but i can't realy figure out what the "invalid value" can be used. Can someone explain better or with other words what does this answer mean ? And maybe post some example code ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks,&lt;/P&gt;
&lt;P&gt;Arjuna&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Any negative value or value of point greater than the number of records in the data set would be invalid. So if your program sets the point variable to a value outside the range of records in the data set you get into problems.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Sep 2017 20:41:11 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-09-08T20:41:11Z</dc:date>
    <item>
      <title>end-of-file with direct access to read data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394308#M94994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the Certification book (Base) i found this question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no end-of-file condition when you use direct access to read data, so how can&lt;BR /&gt;your program prevent a continuous loop?&lt;BR /&gt;a. Do not use a POINT= variable.&lt;BR /&gt;b. Check for an invalid value of the POINT= variable.&lt;BR /&gt;c. Do not use an END= variable.&lt;BR /&gt;d. Include an OUTPUT statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with this answer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Correct answer: b&lt;BR /&gt;To avoid a continuous loop when using direct access, either include a STOP&lt;BR /&gt;statement or use programming logic that executes a STOP statement when the data&lt;BR /&gt;step encounters an invalid value of the POINT= variable. If SAS reads an invalid&lt;BR /&gt;value of the POINT= variable, it sets the automatic variable _ERROR_ to 1. You can&lt;BR /&gt;use this information to check for conditions that cause continuous looping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand the use of STOP statement but i can't realy figure out what the "invalid value" can be used. Can someone explain better or with other words what does this answer mean ? And maybe post some example code ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Arjuna&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 18:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394308#M94994</guid>
      <dc:creator>arjunascagnetto</dc:creator>
      <dc:date>2017-09-08T18:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: end-of-file with direct access to read data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394318#M94995</link>
      <description>&lt;P&gt;Looks like a really poor question.&lt;/P&gt;
&lt;P&gt;If you are using a loop of some sort with POINT= option on SET to do access you could also use NOBS= option so you know how many observations there are.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  do p=1 to nobs;
    set have point=p nobs=nobs;
    output;
  end;
  stop;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are reading a list of observation numbers from another dataset then you could also use NOBS to check before even trying to use POINT=. &amp;nbsp;No need for a STOP statement in this case as the step will stop when it reads past the end of the dataset RECORD_LIST.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
   set record_list;
   if 1 &amp;lt;= recno &amp;lt;= nobs then set have point=recno nobs=nobs;
   else put 'Hey there is no observation number ' recno ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of like they said you could just check the _ERROR_ variable and assume that means you tried to read something that wasn't there and stop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set sashelp.class point=_n_ ;
  if _error_ then do;
    put 'Somthing happened.' _n_=; 
    stop; 
  end;
  else output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 18:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394318#M94995</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-08T18:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: end-of-file with direct access to read data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394322#M94996</link>
      <description>&lt;P&gt;Is this the Advanced Guide? The Base certification doesn't cover EOF/POINTER access the last time I checked...though I could easily be mistaken.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 19:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394322#M94996</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-08T19:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: end-of-file with direct access to read data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394345#M95003</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42549"&gt;@arjunascagnetto&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the Certification book (Base) i found this question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no end-of-file condition when you use direct access to read data, so how can&lt;BR /&gt;your program prevent a continuous loop?&lt;BR /&gt;a. Do not use a POINT= variable.&lt;BR /&gt;b. Check for an invalid value of the POINT= variable.&lt;BR /&gt;c. Do not use an END= variable.&lt;BR /&gt;d. Include an OUTPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with this answer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correct answer: b&lt;BR /&gt;To avoid a continuous loop when using direct access, either include a STOP&lt;BR /&gt;statement or use programming logic that executes a STOP statement when the data&lt;BR /&gt;step encounters an invalid value of the POINT= variable. If SAS reads an invalid&lt;BR /&gt;value of the POINT= variable, it sets the automatic variable _ERROR_ to 1. You can&lt;BR /&gt;use this information to check for conditions that cause continuous looping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand the use of STOP statement but i can't realy figure out what the "invalid value" can be used. Can someone explain better or with other words what does this answer mean ? And maybe post some example code ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks,&lt;/P&gt;
&lt;P&gt;Arjuna&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Any negative value or value of point greater than the number of records in the data set would be invalid. So if your program sets the point variable to a value outside the range of records in the data set you get into problems.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 20:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394345#M95003</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-08T20:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: end-of-file with direct access to read data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394455#M95053</link>
      <description>Guide for base programmer certification.</description>
      <pubDate>Sat, 09 Sep 2017 17:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-file-with-direct-access-to-read-data/m-p/394455#M95053</guid>
      <dc:creator>arjunascagnetto</dc:creator>
      <dc:date>2017-09-09T17:04:34Z</dc:date>
    </item>
  </channel>
</rss>

