<?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 code problem. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532558#M6030</link>
    <description>&lt;P&gt;data test;&lt;BR /&gt;num = 5;&lt;BR /&gt;set sashelp.class point = num ;&lt;BR /&gt;output;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;BR /&gt;proc print ; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, could you please explain the code given above and elaborate why does it keep running on a loop without the "STOP" keyword.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Feb 2019 13:12:54 GMT</pubDate>
    <dc:creator>kkgogoi870</dc:creator>
    <dc:date>2019-02-04T13:12:54Z</dc:date>
    <item>
      <title>SAS code problem.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532558#M6030</link>
      <description>&lt;P&gt;data test;&lt;BR /&gt;num = 5;&lt;BR /&gt;set sashelp.class point = num ;&lt;BR /&gt;output;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;BR /&gt;proc print ; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, could you please explain the code given above and elaborate why does it keep running on a loop without the "STOP" keyword.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 13:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532558#M6030</guid>
      <dc:creator>kkgogoi870</dc:creator>
      <dc:date>2019-02-04T13:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code problem.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532560#M6031</link>
      <description>&lt;P&gt;&amp;nbsp;@&amp;nbsp;&lt;A id="link_8" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/110010" target="_self"&gt;&lt;SPAN class=""&gt;kkgogoi870&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;The POINT option tells SAS to read a specific observation from a SAS dataset, and what your code is going to do (without the STOP), is read observation #5, write that to the output dataset, then go back to the top of the data step and read observation #5, write that to the output dataset, and continue to do that over and over.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to the &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p00hxg3x8lwivcn1f0e9axziw57y.htm&amp;amp;locale=en" target="_self"&gt;POINT option documentation&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE class="xis-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xis-caution"&gt;CAUTION:&lt;/TD&gt;
&lt;TD class="xis-summaryText"&gt;
&lt;DIV class="xis-caution"&gt;
&lt;DIV class="xis-cautionLeadin"&gt;Continuous loops can occur when you use the POINT= option.&lt;/DIV&gt;
&lt;DIV id="p15ywqhi9zo310n1uycpk69dzuh2" class="xis-paraSimple"&gt;When you use the POINT= option, you must include a STOP statement to stop DATA step processing, or programming logic that checks for an invalid value of the POINT= variable, or both. Because POINT= reads only those observations that are specified in the DO statement, SAS cannot read an end-of-file indicator as it would if the file were being read sequentially. Because reading an end-of-file indicator ends a DATA step automatically, failure to substitute another means of ending the DATA step when you use POINT= can cause the DATA step to go into a continuous loop. If SAS reads an invalid value of the POINT= variable, it sets the automatic variable _ERROR_ to 1. Use this information to check for conditions that cause continuous DO-loop processing, or include a STOP statement at the end of the DATA step, or both.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 13:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532560#M6031</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2019-02-04T13:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code problem.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532561#M6032</link>
      <description>&lt;P&gt;It helps to understand why this simple DATA step ends:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data new;&lt;/P&gt;
&lt;P&gt;set old;&lt;/P&gt;
&lt;P&gt;num=5;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SET statement will read the observations one at a time.&amp;nbsp; If there are 100 observations in OLD, they each get read in separately.&amp;nbsp; However, reading the 100th observation does not end the DATA step.&amp;nbsp; Instead, the SET statement continues and tries to read the 101st observation.&amp;nbsp; Since there is no 101st observation, that's when the DATA step ends.&amp;nbsp; The key step is trying to read another observation, and finding that there are no more observations to read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Compare that to the DATA step that you posted.&amp;nbsp; Because of POINT= the SET statement always finds an observation.&amp;nbsp; The normal mechanism to end the DATA step (having the SET statement fail to find the observation it is looking for) never comes into play.&amp;nbsp; That's why you get an infinite loop without the STOP statement.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 13:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532561#M6032</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-04T13:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code problem.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532567#M6033</link>
      <description>&lt;P&gt;An excellent answer.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 14:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-code-problem/m-p/532567#M6033</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2019-02-04T14:18:22Z</dc:date>
    </item>
  </channel>
</rss>

