<?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: Need to break from a data step with a return a code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378601#M91030</link>
    <description>&lt;P&gt;Personally I find the whole breaking out of programs to be not a good methodology. &amp;nbsp;Code should run fully and then return its final value and outputs at all times. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;A question for you, which jumped to mind with the above in mind, I am sure (and its been years since I used it) Unix has string find utilities and such like, so why do you need to read the file into SAS, check for a string, and then jump back to the operating system. &amp;nbsp;Can all this not be done directly in the OS scripting? &amp;nbsp;Even better would be to get a file which is directly usable rather than finding strings. &amp;nbsp;It just seems to be using SAS for the sake of using it.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jul 2017 08:19:44 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-07-24T08:19:44Z</dc:date>
    <item>
      <title>Need to break from a data step with a return a code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378592#M91023</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am executing my SAS pgms in unix environment, so executes the .sas pgms in shl.&lt;/P&gt;&lt;P&gt;Now i have a requirement to break a datastep on a particular condition &amp;amp; return a code to shl, so that based on the return code shl will call a sql loader which loads data to oracle table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data header;&lt;BR /&gt;infile "&amp;lt;path&amp;gt;/data.dat" dlm="|";&lt;BR /&gt;input recds : $2.&lt;BR /&gt;id : 18.&lt;BR /&gt;name : $30.&lt;BR /&gt;chk_flg : $1.;&lt;BR /&gt;&lt;BR /&gt;if(chk_flg) = 'Y';&lt;BR /&gt;then &amp;lt;the pgm needs to break with a return code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 07:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378592#M91023</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2017-07-24T07:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need to break from a data step with a return a code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378599#M91027</link>
      <description>&lt;P&gt;Try using ABORT RETURN - the documentation is&amp;nbsp;&lt;A href="http://documentation.sas.com/?docsetId=hostunx&amp;amp;docsetTarget=n0cndzg0o5pkcin1831y552h89hf.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 08:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378599#M91027</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-07-24T08:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need to break from a data step with a return a code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378601#M91030</link>
      <description>&lt;P&gt;Personally I find the whole breaking out of programs to be not a good methodology. &amp;nbsp;Code should run fully and then return its final value and outputs at all times. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;A question for you, which jumped to mind with the above in mind, I am sure (and its been years since I used it) Unix has string find utilities and such like, so why do you need to read the file into SAS, check for a string, and then jump back to the operating system. &amp;nbsp;Can all this not be done directly in the OS scripting? &amp;nbsp;Even better would be to get a file which is directly usable rather than finding strings. &amp;nbsp;It just seems to be using SAS for the sake of using it.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 08:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378601#M91030</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-24T08:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need to break from a data step with a return a code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378606#M91033</link>
      <description>&lt;P&gt;Ok so to answer to your 2nd part, we have a process in place which already uses SAS pgm &amp;amp; run it to completion. The SAS pgm checks few columns(its a validation of data pgm). Now the there is a new requirement which is the file will be submitted at the same path(if the file arrives at the path, the already existing pgm triggers), same file name, only addition is an extra column in header. If we read that SAS dont have to do anything. Hope this makes sense.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 08:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378606#M91033</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2017-07-24T08:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need to break from a data step with a return a code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378610#M91036</link>
      <description>&lt;P&gt;Given that you have UNIX, I'd solve that with the cut and grep utilities directly from the shell:&lt;/P&gt;
&lt;PRE&gt;if cut -f3 -d'|' filename|grep Y&amp;gt;/dev/null
then
  #execute as wanted
else
  #put message
fi&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 09:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-break-from-a-data-step-with-a-return-a-code/m-p/378610#M91036</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-24T09:02:45Z</dc:date>
    </item>
  </channel>
</rss>

