<?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: Have SAS return an error if dates are missing from the selected range in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287543#M19629</link>
    <description>&lt;P&gt;An alternate approach to test before the data step and create a macro variable that could be used for program flow.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select case 
            when (("&amp;amp;Week_Prompt_MAX."d - "&amp;amp;Week_Prompt_MIN."d)+1) - count(*) &amp;gt;0 then 'Missing'
            else 'Present'
          end as DateCompare INTO : DateCompare
   from (select distinct Event_dt from Cartel.preagent_telephony
         where Event_dt Between "&amp;amp;Week_Prompt_MIN."d and "&amp;amp;Week_Prompt_MAX."d
               and CALL_TYPE = 'External'
		         and PROGRAMME_NM IN ("1.1 SSW")
         )
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Jul 2016 17:53:43 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-07-27T17:53:43Z</dc:date>
    <item>
      <title>Have SAS return an error if dates are missing from the selected range</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287378#M19621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In am using a date prompt to select a range of dates and want the ability for SAS to return an error if a date is missing from the date range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example: selected date range 20Jul2016 to 24Jul2016 and the data for 24Jul2016 is missing&lt;/P&gt;&lt;PRE&gt;Data Work.SSW;
	Set Cartel.preagent_telephony;
	Keep EVENT_DT PROGRAMME_NM SERVICE_NM CLUSTER CALLS_ANSWERED_CNT
		CALLS_ABANDONED_CNT TOTAL_ANSWER_TM MBL;
	Where Event_dt Between "&amp;amp;Week_Prompt_MIN."d and "&amp;amp;Week_Prompt_MAX."d
		and CALL_TYPE = 'External'
		and PROGRAMME_NM IN ("1.1 SSW");

	IF Cluster_ID in ('1' , '6', '9', '13', '18', '27') and Queue_Type IN ('A', 'B') THEN
		MBL = 'MBL';
	ELSE MBL = 'Other';
Run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&amp;nbsp; (SAS 7.11)&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 00:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287378#M19621</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2016-07-27T00:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Have SAS return an error if dates are missing from the selected range</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287405#M19622</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a work dataset and comparing if any date is missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If date missing then give error message and abort.&lt;/P&gt;&lt;PRE&gt;Data work.DATE_RANGE;
format Event_dt date9.;
do Event_dt = "&amp;amp;Week_Prompt_MIN."d TO "&amp;amp;Week_Prompt_MAX."d
OUTPUT;
end;
RUN;
&lt;BR /&gt;proc sort data=work.SSW ; by Event_dt; run;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;Data Work.SSW; &lt;BR /&gt;MERGE Cartel.preagent_telephony(IN=A) WORK.DATE_RANGE(IN=B);&lt;BR /&gt;BY Event_dt ; &lt;BR /&gt;Keep EVENT_DT PROGRAMME_NM SERVICE_NM CLUSTER CALLS_ANSWERED_CNT &lt;BR /&gt;CALLS_ABANDONED_CNT TOTAL_ANSWER_TM MBL; &lt;BR /&gt;&lt;BR /&gt;Where Event_dt Between "&amp;amp;Week_Prompt_MIN."d and "&amp;amp;Week_Prompt_MAX."d&lt;BR /&gt; and CALL_TYPE = 'External' and PROGRAMME_NM IN ("1.1 SSW"); &lt;BR /&gt;&lt;BR /&gt;IF B AND NOT A THEN&lt;BR /&gt; DO; &lt;BR /&gt;PUT "ERROR: DATE RANGE MISSING"; &lt;BR /&gt;ABORT CANCEL; &lt;BR /&gt;END; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;IF Cluster_ID in ('1' , '6', '9', '13', '18', '27')&lt;BR /&gt;and Queue_Type IN ('A', 'B') &lt;BR /&gt;THEN MBL = 'MBL'; ELSE MBL = 'Other'; &lt;BR /&gt;&lt;BR /&gt;Run;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 03:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287405#M19622</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-07-27T03:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Have SAS return an error if dates are missing from the selected range</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287543#M19629</link>
      <description>&lt;P&gt;An alternate approach to test before the data step and create a macro variable that could be used for program flow.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select case 
            when (("&amp;amp;Week_Prompt_MAX."d - "&amp;amp;Week_Prompt_MIN."d)+1) - count(*) &amp;gt;0 then 'Missing'
            else 'Present'
          end as DateCompare INTO : DateCompare
   from (select distinct Event_dt from Cartel.preagent_telephony
         where Event_dt Between "&amp;amp;Week_Prompt_MIN."d and "&amp;amp;Week_Prompt_MAX."d
               and CALL_TYPE = 'External'
		         and PROGRAMME_NM IN ("1.1 SSW")
         )
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 17:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Have-SAS-return-an-error-if-dates-are-missing-from-the-selected/m-p/287543#M19629</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-27T17:53:43Z</dc:date>
    </item>
  </channel>
</rss>

