<?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: calculating calendar days and work days with intck in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760085#M240305</link>
    <description>&lt;P&gt;Thanks so much for the quick reply. I've used day and weekday before although not often. It was frustrating not being able to figure out why it wouldn't work. Now I know what the "dt" is for. I don't remember seeing that before.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again.&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
    <pubDate>Fri, 06 Aug 2021 20:17:35 GMT</pubDate>
    <dc:creator>DanD999</dc:creator>
    <dc:date>2021-08-06T20:17:35Z</dc:date>
    <item>
      <title>calculating calendar days and work days with intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760082#M240303</link>
      <description>&lt;P&gt;What am I doing wrong. I copied the "diff" example out of a SAS blog and it doesn't work for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data table2;
infile datalines dlm=',';
input h_id date1 :DATETIME24.3 date2 :DATETIME24.3;
format date1 date2 DATETIME24.3;
return;
datalines;
52,16AUG2021:20:52:52.136,09JUL2021:08:52:29.693
10,11AUG2021:22:24:41.894,09JUL2021:16:40:26.374
41,13AUG2021:20:01:24.427,18JUL2021:14:38:36.254
74,23AUG2021:19:33:19.111,18JUL2021:14:54:06.874
37,08AUG2021:19:51:53.322,18JUL2021:15:54:10.637
82,23AUG2021:20:27:52.563,26JUL2021:15:47:00.000
90,28AUG2021:20:28:50.595,29JUL2021:18:46:08.624
65,22AUG2021:14:50:58.576,27JUL2021:18:46:08.624
23,01AUG2021:23:59:58.285,25JUL2021:18:46:08.624
;
run;

data table3;
	set table2;
	 calendar_days =intck('dtday', date2, date1);
	 calendar_days1 =intck('day', date2, date1);
	 week_days=intck('WEEKDAY', date2, date1);
	 diff = intck('WEEKDAY', date2, date1);
run;

&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 Aug 2021 20:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760082#M240303</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2021-08-06T20:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: calculating calendar days and work days with intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760083#M240304</link>
      <description>&lt;P&gt;You need to specify dates, not datetimes. If you do specify datetimes you need to use DT in front of the interval specification, as your first one which is why it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;	 calendar_days =intck('&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;dt&lt;/STRONG&gt;&lt;/FONT&gt;day', date2, date1);
	 calendar_days1 =intck('day', date2, date1);
	 week_days=intck('WEEKDAY', date2, date1);
	 diff = intck('WEEKDAY', date2, date1);&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0syn64amroombn14vrdzksh459w.htm#n1wbckrlffgb8jn15eebgjpqm23c" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0syn64amroombn14vrdzksh459w.htm#n1wbckrlffgb8jn15eebgjpqm23c&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Interval Names and SAS Dates&lt;BR /&gt;Specific interval names are used with SAS date values, and other interval names are used with SAS time and datetime values. The interval names that are used with SAS date values are YEAR, SEMIYEAR, QTR, MONTH, SEMIMONTH, TENDAY, WEEK, WEEKDAY, and DAY. The interval names that are used with SAS time and datetime values are HOUR, MINUTE, and SECOND.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Interval names that are used with SAS date values can be prefixed with 'DT' to construct interval names for use with SAS datetime values.&lt;/STRONG&gt; The interval names DTYEAR, DTSEMIYEAR, DTQTR, DTMONTH, DTSEMIMONTH, DTTENDAY, DTWEEK, DTWEEKDAY, and DTDAY are used with SAS time or datetime values.&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/49285"&gt;@DanD999&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What am I doing wrong. I copied the "diff" example out of a SAS blog and it doesn't work for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data table2;
infile datalines dlm=',';
input h_id date1 :DATETIME24.3 date2 :DATETIME24.3;
format date1 date2 DATETIME24.3;
return;
datalines;
52,16AUG2021:20:52:52.136,09JUL2021:08:52:29.693
10,11AUG2021:22:24:41.894,09JUL2021:16:40:26.374
41,13AUG2021:20:01:24.427,18JUL2021:14:38:36.254
74,23AUG2021:19:33:19.111,18JUL2021:14:54:06.874
37,08AUG2021:19:51:53.322,18JUL2021:15:54:10.637
82,23AUG2021:20:27:52.563,26JUL2021:15:47:00.000
90,28AUG2021:20:28:50.595,29JUL2021:18:46:08.624
65,22AUG2021:14:50:58.576,27JUL2021:18:46:08.624
23,01AUG2021:23:59:58.285,25JUL2021:18:46:08.624
;
run;

data table3;
	set table2;
	 calendar_days =intck('dtday', date2, date1);
	 calendar_days1 =intck('day', date2, date1);
	 week_days=intck('WEEKDAY', date2, date1);
	 diff = intck('WEEKDAY', date2, date1);
run;

&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 20:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760083#M240304</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-06T20:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: calculating calendar days and work days with intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760085#M240305</link>
      <description>&lt;P&gt;Thanks so much for the quick reply. I've used day and weekday before although not often. It was frustrating not being able to figure out why it wouldn't work. Now I know what the "dt" is for. I don't remember seeing that before.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again.&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 20:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760085#M240305</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2021-08-06T20:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: calculating calendar days and work days with intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760088#M240306</link>
      <description>&lt;P&gt;Here's a great, but longer and in depth, reference for dates and times in SAS that's useful&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 20:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760088#M240306</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-06T20:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: calculating calendar days and work days with intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760700#M240555</link>
      <description>&lt;P&gt;Thanks Reeza.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 16:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculating-calendar-days-and-work-days-with-intck/m-p/760700#M240555</guid>
      <dc:creator>DanD999</dc:creator>
      <dc:date>2021-08-10T16:15:46Z</dc:date>
    </item>
  </channel>
</rss>

