<?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: proc sql to calculate difference of business days between two dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673807#M202767</link>
    <description>Thank you, I am working with SAS as a pass through for Teradata databases; is there a way to impose a single date format in upstream code to assure this code will work? Thanks so much!&lt;BR /&gt;</description>
    <pubDate>Fri, 31 Jul 2020 18:38:03 GMT</pubDate>
    <dc:creator>Jordana_Anthem</dc:creator>
    <dc:date>2020-07-31T18:38:03Z</dc:date>
    <item>
      <title>proc sql to calculate difference of business days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673793#M202758</link>
      <description>&lt;P&gt;Using proc sql (passing teradata) I need to calculate the number of business days between two dates:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,intck('WEEKDAY', a.OPEN_DATE, b.DSCHRG_DT) as Num_BD_Diff&amp;nbsp; (this did not work)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the correct code to use?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any advice!&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 17:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673793#M202758</guid>
      <dc:creator>Jordana_Anthem</dc:creator>
      <dc:date>2020-07-31T17:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql to calculate difference of business days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673804#M202765</link>
      <description>&lt;P&gt;Does work. If OPEN_DATE and DSCHRG_DT are dates. If one or the other is a datetime or a character string, it won't work.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 18:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673804#M202765</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-07-31T18:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql to calculate difference of business days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673807#M202767</link>
      <description>Thank you, I am working with SAS as a pass through for Teradata databases; is there a way to impose a single date format in upstream code to assure this code will work? Thanks so much!&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Jul 2020 18:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673807#M202767</guid>
      <dc:creator>Jordana_Anthem</dc:creator>
      <dc:date>2020-07-31T18:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql to calculate difference of business days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673830#M202780</link>
      <description>&lt;P&gt;I can't help you on the Teradata side of things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, on the SAS side,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If both variables are received as datetimes use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;intck('DTWEEKDAY', a.OPEN_DATE, b.DSCHRG_DT)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if a.OPEN_DATE is a date and b.DSCHRG_DT is a datetime, use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;intck('WEEKDAY', a.OPEN_DATE, datepart(b.DSCHRG_DT))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and finally, if one of your variables is a character string, convert it to a SAS date using the PUT() function with the appropriate format for that string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;intck('WEEKDAY', PUT(a.OPEN_DATE, date9.), b.DSCHRG_DT)&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 20:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673830#M202780</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-07-31T20:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql to calculate difference of business days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673838#M202785</link>
      <description>This code will work: ,intck('WEEKDAY', a.OPEN_DATE, b.DSCHRG_DT) as Num_BD_Diff&lt;BR /&gt;as long as in an upstream query or subquery the Teradata dates are declared something like:&lt;BR /&gt;,cast(b.DSCHRG_DT as date) as discharge_date. Thanks!</description>
      <pubDate>Fri, 31 Jul 2020 21:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-to-calculate-difference-of-business-days-between-two/m-p/673838#M202785</guid>
      <dc:creator>Jordana_Anthem</dc:creator>
      <dc:date>2020-07-31T21:54:43Z</dc:date>
    </item>
  </channel>
</rss>

