<?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 Stop program execution at a particular row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374639#M89725</link>
    <description>&lt;P&gt;I'm trying to find a way to halt execution at a particular row.&amp;nbsp;&amp;nbsp; "Abort Abend" will do it, but it also seems to delete all my temprorary files.&amp;nbsp;&amp;nbsp; Is there a way to stop execution at particular row and keep the temporary files in the work directory?&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2017 18:27:30 GMT</pubDate>
    <dc:creator>Batman</dc:creator>
    <dc:date>2017-07-10T18:27:30Z</dc:date>
    <item>
      <title>Stop program execution at a particular row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374639#M89725</link>
      <description>&lt;P&gt;I'm trying to find a way to halt execution at a particular row.&amp;nbsp;&amp;nbsp; "Abort Abend" will do it, but it also seems to delete all my temprorary files.&amp;nbsp;&amp;nbsp; Is there a way to stop execution at particular row and keep the temporary files in the work directory?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374639#M89725</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2017-07-10T18:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Stop program execution at a particular row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374646#M89728</link>
      <description>&lt;P&gt;In a DATA step, the STOP statement halts the current step.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if amount &amp;gt; 5000 then stop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It stops before outputting the current observation.&amp;nbsp; In this case, the output data set contains zero observations with amount greater than 5000.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374646#M89728</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-10T18:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Stop program execution at a particular row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374647#M89729</link>
      <description>&lt;P&gt;Understood.&amp;nbsp;&amp;nbsp; However, unless I'm mistaken, the stop statement within a data step would only halt execution for that particular data step.&amp;nbsp;&amp;nbsp; Subsequent steps would proceed.&amp;nbsp;&amp;nbsp;&amp;nbsp; I'd like the halt execution of the entire program, so no subsequent steps would run.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374647#M89729</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2017-07-10T18:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stop program execution at a particular row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374652#M89732</link>
      <description>&lt;P&gt;That takes a lot more work.&amp;nbsp; For example, you could define&amp;nbsp;a macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro runn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %global halt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; run &amp;amp;halt;&lt;/P&gt;
&lt;P&gt;%mend runn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then end every step by replacing the RUN; statement with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%runn&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in your DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if amount &amp;gt; 5000 then call symput('halt', 'cancel');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before this point, the %RUNN macro would generate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Afterwards, it generates:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run cancel;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's no easy way that I know of.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stop-program-execution-at-a-particular-row/m-p/374652#M89732</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-10T18:54:08Z</dc:date>
    </item>
  </channel>
</rss>

