<?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: Difference between dates excluding weekends in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560847#M33756</link>
    <description>&lt;P&gt;can this be done in a computed column in query builder&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2019 14:33:57 GMT</pubDate>
    <dc:creator>CTT53</dc:creator>
    <dc:date>2019-05-22T14:33:57Z</dc:date>
    <item>
      <title>Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560832#M33752</link>
      <description>&lt;P&gt;Hey folks&lt;/P&gt;&lt;P&gt;I am have read and tried many of the suggestions for the time between 2 dates excluding weekends and have been unsuccessful.&amp;nbsp;&amp;nbsp; I am a beginner SAS user and all of my data has been done in query builder.&amp;nbsp; I have a min date and a max date and I am looking at getting the difference between the dates excluding weekends.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Can this be done in query builder?&amp;nbsp; I do not want to have to export to excel to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help you can provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 13:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560832#M33752</guid>
      <dc:creator>CTT53</dc:creator>
      <dc:date>2019-05-22T13:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560834#M33753</link>
      <description>I use a variant of this:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2011/05/09/calculating-the-number-of-working-days-between-two-dates/" target="_blank"&gt;https://blogs.sas.com/content/sasdummy/2011/05/09/calculating-the-number-of-working-days-between-two-dates/&lt;/A&gt;</description>
      <pubDate>Wed, 22 May 2019 13:35:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560834#M33753</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-05-22T13:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560835#M33754</link>
      <description>&lt;P&gt;Did you try the WEEKDAY interval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 55         
 56         data _null_;
 57         x = today();
 58         y = '01May2019'd;
 59         format x y date11.;
 60         d1 = intck('DAY',y,x);
 61         d2 = intck('WEEKDAY',y,x);
 62         put _all_;
 63         run;
 
 x=22-MAY-2019 y=01-MAY-2019 d1=21 d2=15
&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 May 2019 13:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560835#M33754</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-05-22T13:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560836#M33755</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   mindate='22may2019'd;
   maxdate='31dec2019'd;
   days=intck('WEEKDAY',mindate,maxdate);
   put days=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 May 2019 13:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560836#M33755</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-22T13:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560847#M33756</link>
      <description>&lt;P&gt;can this be done in a computed column in query builder&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 14:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/560847#M33756</guid>
      <dc:creator>CTT53</dc:creator>
      <dc:date>2019-05-22T14:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561109#M33774</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205469"&gt;@CTT53&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes. Just try it.&lt;/P&gt;
&lt;P&gt;INTCK() is a function like any other.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 12:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561109#M33774</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-23T12:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561111#M33775</link>
      <description>&lt;P&gt;I have tried&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;intck('weekday',t2.'Min Pre-Underwriting'n,t2.'Max Pre-Underwriting'n)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this does not work.&amp;nbsp;The computed column is empty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 12:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561111#M33775</guid>
      <dc:creator>CTT53</dc:creator>
      <dc:date>2019-05-23T12:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561255#M33786</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205469"&gt;@CTT53&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have tried&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;intck('weekday',t2.'Min Pre-Underwriting'n,t2.'Max Pre-Underwriting'n)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and this does not work.&amp;nbsp;The computed column is empty&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205469"&gt;@CTT53&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does the SAS log tell you? Any messages about missing values?&lt;/P&gt;
&lt;P&gt;The function works, something with your data must be different than expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below EG QueryBuilder generated code that returns expected values. What you set up needs to look similar.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   CREATE TABLE WORK.QUERY_FOR_HAVE AS 
   SELECT t1.Min_Pre_Underwriting, 
          t1.Max_Pre_Underwriting, 
          /* weekdays */
            (intck('weekday',t1.Min_Pre_Underwriting,t1.Max_Pre_Underwriting)) FORMAT=best32. AS weekdays, 
          /* days */
            (t1.Max_Pre_Underwriting-t1.Min_Pre_Underwriting) FORMAT=best32. AS days
      FROM WORK.HAVE t1;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 23:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561255#M33786</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-23T23:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561259#M33787</link>
      <description>&lt;P&gt;I just replicated&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;'s code, and it works fine for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thought; if you're using datetime values, not dates, that will mess things up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a little snippet of code that sets up some test data for you to play with. Just drop it into a code window and run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
	format Max_Pre_Underwriting Min_Pre_Underwriting date.;
	Max_Pre_Underwriting = '01feb2019'd;
	do Min_Pre_Underwriting = '01dec2017'd to '31jan2019'd;
		output;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 May 2019 00:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561259#M33787</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-05-24T00:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561263#M33789</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205469"&gt;@CTT53&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here the data step I've used to create sample data for the EG QueryBuilder&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  format Min_Pre_Underwriting Max_Pre_Underwriting date9.;
  Min_Pre_Underwriting='01jan2019'd;
  do Max_Pre_Underwriting=Min_Pre_Underwriting to today() by 4;
    output;
  end;
  stop;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the reason I've also added below days calculation to the query:&lt;/P&gt;
&lt;PRE&gt;(t1.Max_Pre_Underwriting-t1.Min_Pre_Underwriting) FORMAT=best32. AS days&lt;/PRE&gt;
&lt;P&gt;If this returns missings then you know you get unexpected results because you're dealing with missings from source.&lt;/P&gt;
&lt;P&gt;If you get very wrong numbers (like way too big) then you know you're dealing with something else than SAS Date values.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 00:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/561263#M33789</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-24T00:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/562822#M33843</link>
      <description>&lt;P&gt;I do not get any errors when with the string.&amp;nbsp; The results are blank&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 12:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/562822#M33843</guid>
      <dc:creator>CTT53</dc:creator>
      <dc:date>2019-05-31T12:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates excluding weekends</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/562845#M33846</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205469"&gt;@CTT53&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I do not get any errors when with the string.&amp;nbsp; The results are blank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Something with your data must be different than expected.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What does the SAS log tell you? Any Notes about creating missing values?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;May be share the relevant bit of the SAS log with us. May be also share with us the result of a Proc Contents for your source table.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 14:02:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-dates-excluding-weekends/m-p/562845#M33846</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-31T14:02:32Z</dc:date>
    </item>
  </channel>
</rss>

