<?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: How to end sas session conditionally in Batch mode (UNIX) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199636#M37331</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;call system runs a system process, in this case it will try to run the program endsas if such is found in your search path.&lt;/P&gt;&lt;P&gt;I guess you want to use call execute, but why go to such a hassle?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _nobs = 0 then abort abend 4;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Aug 2015 06:34:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-08-17T06:34:55Z</dc:date>
    <item>
      <title>How to end sas session conditionally in Batch mode (UNIX)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199631#M37326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;My SAS code has mutliple data step and proc steps. I want end the sas session when certain condition met.&lt;/P&gt;&lt;P&gt;I am running my sas code on UNIX in batch mode. When certain dataset has 0 observations, I want to end session. I used following is example code, it's not working as I expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..multiple sas data, proc steps&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set old_dataset nobs=_nobs;&lt;/P&gt;&lt;P&gt;if _nobs=0 then call system('endsas');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..multiple data steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2015 04:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199631#M37326</guid>
      <dc:creator>nbonda</dc:creator>
      <dc:date>2015-08-15T04:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to end sas session conditionally in Batch mode (UNIX)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199632#M37327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to test NOBS before the SET statement executes. Otherwise the data step stops as soon as the SET statement tries to read past the end of the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;if _nobs=0 then call system('endsas');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;else stop;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set old_dataset nobs=_nobs;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2015 23:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199632#M37327</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-15T23:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to end sas session conditionally in Batch mode (UNIX)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199633#M37328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Statements endsas and errorabend are doable in batch, developping in Eguide (and others) it is a bad approach.&amp;nbsp; &lt;A _jive_internal="true" href="https://communities.sas.com/message/148347"&gt;https://communities.sas.com/message/148347&lt;/A&gt; see CH&lt;BR /&gt;In structures programming it is better to validate all conditions at the first steps. Than only whan all input is valid to proceed&lt;/P&gt;&lt;P&gt;With a bathc approach don't make the program too big. smaller pieces are easily connected. Restarting / recovering will become more easy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 06:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199633#M37328</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-08-16T06:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to end sas session conditionally in Batch mode (UNIX)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199634#M37329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Than you for reply. I modified the code and ran the batch job. The sas session not terminating, still continue to process further sas steps. am I missing to add anything? endsas is not terminating session here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 19:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199634#M37329</guid>
      <dc:creator>nbonda</dc:creator>
      <dc:date>2015-08-16T19:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to end sas session conditionally in Batch mode (UNIX)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199635#M37330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you remember to include the semi-colon for the ENDSAS statement in the CALL EXECUTE() call?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 01:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199635#M37330</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-17T01:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to end sas session conditionally in Batch mode (UNIX)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199636#M37331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;call system runs a system process, in this case it will try to run the program endsas if such is found in your search path.&lt;/P&gt;&lt;P&gt;I guess you want to use call execute, but why go to such a hassle?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _nobs = 0 then abort abend 4;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 06:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-end-sas-session-conditionally-in-Batch-mode-UNIX/m-p/199636#M37331</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-08-17T06:34:55Z</dc:date>
    </item>
  </channel>
</rss>

