<?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 Data step execution based on condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/413830#M101320</link>
    <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a situation where I need to run different data step based on output from 1st PROC SQL. I was looking for GOTO statement but it will not help because it needs to be used inside one data step.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL 
        query to get the details from DB2 table. 
QUIT;
DATA _NULL_;
 if &amp;amp;sqlobs = 0 
      I need to bypass below proc steps and execute the code from label XXXX

run; 

proc sort data=xxx;
run;

proc SQL 
   another query to get data from DB2 
quit;
&lt;BR /&gt;DATA ABCD;&lt;BR /&gt;  SET AAAA ( KEEP=XX,YY,ZZ,...);&lt;BR /&gt;  few logics here.. 
run;&lt;BR /&gt;
&lt;STRONG&gt;XXXX:&lt;/STRONG&gt; 

proc SQL 
  get data from DB2 table for another processing
quit;


proc print; 
...
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any suggestion will be really helpful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;pk&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 22:30:29 GMT</pubDate>
    <dc:creator>batu544</dc:creator>
    <dc:date>2017-11-15T22:30:29Z</dc:date>
    <item>
      <title>Data step execution based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/413830#M101320</link>
      <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a situation where I need to run different data step based on output from 1st PROC SQL. I was looking for GOTO statement but it will not help because it needs to be used inside one data step.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL 
        query to get the details from DB2 table. 
QUIT;
DATA _NULL_;
 if &amp;amp;sqlobs = 0 
      I need to bypass below proc steps and execute the code from label XXXX

run; 

proc sort data=xxx;
run;

proc SQL 
   another query to get data from DB2 
quit;
&lt;BR /&gt;DATA ABCD;&lt;BR /&gt;  SET AAAA ( KEEP=XX,YY,ZZ,...);&lt;BR /&gt;  few logics here.. 
run;&lt;BR /&gt;
&lt;STRONG&gt;XXXX:&lt;/STRONG&gt; 

proc SQL 
  get data from DB2 table for another processing
quit;


proc print; 
...
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any suggestion will be really helpful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;pk&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 22:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/413830#M101320</guid>
      <dc:creator>batu544</dc:creator>
      <dc:date>2017-11-15T22:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data step execution based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/413833#M101322</link>
      <description>&lt;P&gt;You need a macro &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; But, it's a pretty basic one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a fully worked example that is from the SAS documentation. It checks if a data set has observations and prints it or otherwise prints a message to the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p011imau3tm4jen1us2a45cyenz9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p011imau3tm4jen1us2a45cyenz9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's fully explained so its a good starting point. But, if you have any further questions, feel free to post back.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Full list of macros in the appendix (for reference):&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172709"&gt;@batu544&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a situation where I need to run different data step based on output from 1st PROC SQL. I was looking for GOTO statement but it will not help because it needs to be used inside one data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL 
        query to get the details from DB2 table. 
QUIT;
DATA _NULL_;
 if &amp;amp;sqlobs = 0 
      I need to bypass below proc steps and execute the code from label XXXX

run; 

proc sort data=xxx;
run;

proc SQL 
   another query to get data from DB2 
quit;
&lt;BR /&gt;DATA ABCD;&lt;BR /&gt;  SET AAAA ( KEEP=XX,YY,ZZ,...);&lt;BR /&gt;  few logics here.. 
run;&lt;BR /&gt;
&lt;STRONG&gt;XXXX:&lt;/STRONG&gt; 

proc SQL 
  get data from DB2 table for another processing
quit;


proc print; 
...
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any suggestion will be really helpful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;pk&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 22:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/413833#M101322</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-15T22:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Data step execution based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/414180#M101469</link>
      <description>Thank you.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Nov 2017 23:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-execution-based-on-condition/m-p/414180#M101469</guid>
      <dc:creator>batu544</dc:creator>
      <dc:date>2017-11-16T23:11:09Z</dc:date>
    </item>
  </channel>
</rss>

