<?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 tigger that pulls the data from SQl based on criteria in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207419#M38557</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I need a SAS Program(Which will be scheduled) that hooks into SQL and look for existence of few records in a table (ex: country=UK date=today and phase=success).&lt;BR /&gt;If SAS program finds success as a value for todays date along with other criteria then it should pull the records from other table.&lt;BR /&gt;If the criteria is not met it should loop back and check again until it finds Phase = success. Along with that it should also send an email saying that the process is successful.&lt;BR /&gt;Hope my question is clear&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;THANKS IN ADVANCE!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jun 2015 14:57:49 GMT</pubDate>
    <dc:creator>M786</dc:creator>
    <dc:date>2015-06-16T14:57:49Z</dc:date>
    <item>
      <title>SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207419#M38557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I need a SAS Program(Which will be scheduled) that hooks into SQL and look for existence of few records in a table (ex: country=UK date=today and phase=success).&lt;BR /&gt;If SAS program finds success as a value for todays date along with other criteria then it should pull the records from other table.&lt;BR /&gt;If the criteria is not met it should loop back and check again until it finds Phase = success. Along with that it should also send an email saying that the process is successful.&lt;BR /&gt;Hope my question is clear&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;THANKS IN ADVANCE!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 14:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207419#M38557</guid>
      <dc:creator>M786</dc:creator>
      <dc:date>2015-06-16T14:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207420#M38558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes this is indeed possible. I've done something very similar except in my case just counting table rows. Building a macro is the way to go. You can use the SLEEP function in macro to create a delay loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a code skeleton you can use to get you started - it will require customisation to your requirements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 9pt; background: white; font-family: Consolas;"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;Loop&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;_Row_Count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;Loop_Count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;Wait_Minutes&amp;nbsp;&amp;nbsp; = 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; Loop_Max_Times = 5; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%do&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%until&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; (&amp;amp;_Row_Count gt &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background: white; font-family: Consolas;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;or (&amp;amp;Loop_Count ge &amp;amp;Loop_Max_Times));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;Loop_Count = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;(&amp;amp;Loop_Count + 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;Time_Now = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;(datetime(), datetime20.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; connect to odbc (noprompt = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: Consolas; font-size: 9pt;"&gt;"YourConnectionString"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; select strip(put(Row_Count, &lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: Consolas; font-size: 9pt;"&gt;comma12.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; into :_Row_Count &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; from connection to odbc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; (SELECT count(*) as Row_Count&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; FROM TableName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; )&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp; disconnect from odbc;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%if &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;&amp;amp;Loop_Max_Times gt &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background: white; font-family: Consolas;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; and &amp;amp;Wait_Minutes gt &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background: white; font-family: Consolas;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;and (&amp;amp;_Row_Count = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background: white; font-family: Consolas;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;slept = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;(sleep(&amp;amp;Wait_Minutes, 60));&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: Consolas; font-size: 9pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 9pt; background: white; font-family: Consolas;"&gt;%mend &lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: Consolas; font-size: 9pt;"&gt;Loop;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 20:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207420#M38558</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-06-16T20:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207421#M38559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SASKiwi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your suggestion. How do I code to search if a record exists(long with the criteria above) in the sql table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 08:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207421#M38559</guid>
      <dc:creator>M786</dc:creator>
      <dc:date>2015-06-17T08:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207422#M38560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to look if a record exists (please refer my original post)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 10:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207422#M38560</guid>
      <dc:creator>M786</dc:creator>
      <dc:date>2015-06-17T10:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207423#M38561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could simply count up the number of rows that satisfies your selection criteria. If the row count is 0 then there is no data for your selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT count(*) as Row_Count&lt;/P&gt;&lt;P&gt;from TableName&lt;/P&gt;&lt;P&gt;where country = 'UK' and date = today() and phase = 'success' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 20:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207423#M38561</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-06-17T20:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207424#M38562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SASKiwi, Thanks again for your valuable suggestions.&lt;/P&gt;&lt;P&gt;Below is the code I have modified to do the following:&lt;/P&gt;&lt;P&gt;If Row_count gt 0 it should extract a table and send a email otherwise wait for 10min and check again.&lt;/P&gt;&lt;P&gt;If Row_count &amp;gt;0(which is true in my case) a table should be extracted from sql. But when I run the below code the table is extracted with or without meeting the condition(Row_count gt 0) and the code does not stop running.&lt;BR /&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;%macro Loop;&lt;BR /&gt;&amp;nbsp; %let Row_count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;BR /&gt;&amp;nbsp; %let yesterday&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = '2015-06-16';&lt;BR /&gt;&amp;nbsp; %let today&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = %sysfunc(today(),yymmdd10.);&lt;BR /&gt;&amp;nbsp; %let Loop_Count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0;&lt;BR /&gt;&amp;nbsp; %let Wait_Minutes&amp;nbsp;&amp;nbsp; = 10; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; %do %until (&amp;amp;Row_count gt 0);&lt;BR /&gt;&amp;nbsp; %let Time_Now = %sysfunc(datetime(), datetime20.); &lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql exec;&lt;BR /&gt;&amp;nbsp; connect to odbc (&amp;amp;connectA);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SELECT count(*) into : Row_count&lt;BR /&gt;&amp;nbsp; FROM connection to odbc&lt;BR /&gt;(&lt;BR /&gt;&amp;nbsp; SELECT * FROM [xxxx].[xxx].[xxxx]&amp;nbsp; A WITH (NOLOCK)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE Category&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; ProcessName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; DBName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; ObjectName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxxxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; Phase&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'SUCCESS' &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND StartDate = &amp;amp;yesterday&lt;/P&gt;&lt;P&gt;&amp;nbsp; );&lt;BR /&gt;&amp;nbsp; disconnect from odbc;&lt;BR /&gt;quit; &lt;/P&gt;&lt;P&gt;%if&amp;nbsp; &amp;amp;Wait_Minutes gt 0&amp;nbsp; %then &lt;BR /&gt;%let slept = %sysfunc(sleep(&amp;amp;Wait_Minutes, 60)); &lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;proc sql exec;&lt;BR /&gt;connect to odbc (&amp;amp;connectA);&lt;BR /&gt;create table data as&lt;BR /&gt;select * from connection to odbc&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;BR /&gt; &lt;BR /&gt; SELECT *&amp;nbsp; FROM [xxxxxx].[xxxx].[exxxxxx]&amp;nbsp; A WITH (NOLOCK)&lt;BR /&gt; );&lt;BR /&gt; disconnect from odbc;&lt;BR /&gt; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend Loop;&lt;/P&gt;&lt;P&gt;%loop;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 11:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207424#M38562</guid>
      <dc:creator>M786</dc:creator>
      <dc:date>2015-06-18T11:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207425#M38563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would do your row count like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql exec;&lt;/P&gt;&lt;P&gt;&amp;nbsp; connect to odbc (&amp;amp;connectA);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SELECT row_count into : Row_count&lt;BR /&gt;&amp;nbsp; FROM connection to odbc&lt;BR /&gt;(&lt;BR /&gt;&amp;nbsp; SELECT count(*) as row_count FROM [xxxx].[xxx].[xxxx]&amp;nbsp; A WITH (NOLOCK)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE Category&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; ProcessName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; DBName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; ObjectName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'xxxxxxx'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; Phase&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'SUCCESS' &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND StartDate = &amp;amp;yesterday&lt;/P&gt;&lt;P&gt;&amp;nbsp; );&lt;BR /&gt;&amp;nbsp; disconnect from odbc;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you don't have any timeout logic in your code hence it keeps running. Add the timeout functionality from my original example. For testing if the timeout works then set it to timeout after 2 loops, for example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should test that the row count logic is working properly for when there are both 0 rows and non-zero rows - do this outside of the macro to keep things simple.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 19:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207425#M38563</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-06-18T19:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS tigger that pulls the data from SQl based on criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207426#M38564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;The reason I have removed the timeout is I will be scheduling this code and&amp;nbsp; there is an option that stops the code running if it runs more than some time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 07:15:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-tigger-that-pulls-the-data-from-SQl-based-on-criteria/m-p/207426#M38564</guid>
      <dc:creator>M786</dc:creator>
      <dc:date>2015-06-19T07:15:49Z</dc:date>
    </item>
  </channel>
</rss>

