<?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: intck('hours') how to exclude certain time and day? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151548#M39900</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found out&amp;nbsp; my company is using version 9.1.3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jan 2014 07:40:42 GMT</pubDate>
    <dc:creator>hellind</dc:creator>
    <dc:date>2014-01-24T07:40:42Z</dc:date>
    <item>
      <title>intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151546#M39898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to calculate SLA in hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this is the logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Work start time: 9am&lt;/P&gt;&lt;P&gt;Work end time: 4pm&lt;/P&gt;&lt;P&gt;exclude public holidays and weekends&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At 4pm the hourly clock stops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; An application is submitted at 1pm on 2nd Jan 2014, and now it is 10am 3rd Jan, then SLA is 4 hours (1pm to 4pm on 2nd Jan, and then 9am to 10 am on 3rd Jan)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another application is submitted at 5pm on 2nd Jan 2014, and now it is 10am 3rd Jan, then SLA is 1 hour&amp;nbsp; ( 9am to 10 am on 3rd Jan)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do it &lt;STRONG&gt;easily&lt;/STRONG&gt;, other than using data step if statements?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are many ways.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 04:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151546#M39898</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2014-01-24T04:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151547#M39899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Investigate in the SAS doc how custom intervals can get created and used. The examples in the doc (or was it a white paper?) are very close to what you are after.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 06:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151547#M39899</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-01-24T06:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151548#M39900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found out&amp;nbsp; my company is using version 9.1.3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 07:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151548#M39900</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2014-01-24T07:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151549#M39901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope the below code helps you by changing few variables:::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length x $20.;&lt;BR /&gt;retain slastart 0;&lt;BR /&gt;day=date();&lt;BR /&gt;time=time();&lt;BR /&gt;slastrdt=dhms(day,0,0,time);&lt;BR /&gt;slaenddt=dhms(sum(day,1),0,0,time);&lt;BR /&gt;hrstr=min(max(hour(slastrdt),9),16);&lt;BR /&gt;hrend=min(max(hour(slaenddt),9),16);&lt;BR /&gt;/****please change this*****/&lt;BR /&gt;dtdiff=intck('day',day,sum(day,1));&lt;BR /&gt;/****************************/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select(hrstr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(9)&amp;nbsp;&amp;nbsp; hrstr=7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(10) hrstr=6;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(11) hrstr=5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(12) hrstr=4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(13) hrstr=3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(14) hrstr=2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(15) hrstr=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(16) hrstr=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; otherwise put"error occured";&lt;BR /&gt;end;&lt;BR /&gt;select(hrend);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(9)&amp;nbsp;&amp;nbsp; hrend=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(10) hrend=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(11) hrend=2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(12) hrend=3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(13) hrend=4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(14) hrend=5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(15) hrend=6;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(16) hrend=7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; otherwise put"error occured";&lt;BR /&gt;end;&lt;BR /&gt;if dtdiff eq 1 then sla=sum(hrstr,hrend);&lt;BR /&gt;else if dtdiff ge 2 then sla=sum(hrstr,hrend,(dtdiff-1)*7);&lt;/P&gt;&lt;P&gt;put sla=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 10:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151549#M39901</guid>
      <dc:creator>Imroze</dc:creator>
      <dc:date>2014-01-24T10:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151550#M39902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="810643" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I believe you forgot about weekends and especially holidays. You will need some sort of calendar for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 10:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151550#M39902</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-01-24T10:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151551#M39903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. I drew inspiration from your code. I got what I want but now I need to exclude public holidays. My approach will be to maintain a list of public holidays in a CSV and import it to a data-set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;TT style="color: #000000; text-align: -webkit-auto;"&gt;DATA HOLIDAYS;&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;TT style="color: #000000; text-align: -webkit-auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INPUT NAME $ HOLIDATE ;&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;TT style="color: #000000; text-align: -webkit-auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATALINES;&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;TT style="color: #000000; text-align: -webkit-auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHRISTMAS 25-DEC-2013&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;TT style="color: #000000; text-align: -webkit-auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEW YEAR&amp;nbsp; 01-JAN-2014&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;TT style="color: #000000; text-align: -webkit-auto;"&gt;;&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How could I incorporate the HOLIDAYS table to the above code to minus 24 hours from SLA?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2014 02:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151551#M39903</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2014-01-28T02:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151552#M39904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you only need the standard US and/or Canadian holidays, you can incorporate the holiday function:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003060817.htm" style="font-size: 10pt; line-height: 1.5em;" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003060817.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for other holidays, you can use: &lt;A href="http://www.sascommunity.org/wiki/Sometimes_One_Needs_an_Option_with_Unusual_Dates" title="http://www.sascommunity.org/wiki/Sometimes_One_Needs_an_Option_with_Unusual_Dates"&gt;Sometimes One Needs an Option with Unusual Dates - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2014 03:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151552#M39904</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-01-28T03:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151553#M39905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I had read those links. I am in Asia, and my company uses SAS 9.1.3.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using INTERVALDS would had been great but this is not suppored in SAS 9.1.3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may have to use loops in datastep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2014 04:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151553#M39905</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2014-01-28T04:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: intck('hours') how to exclude certain time and day?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151554#M39906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hellind&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As the requirement seems to be a support based do you guys work on weekends and holidays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or else we can include few conditions like weekday() for discarding weekends support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the updated code below... hope it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;length x $20.;&lt;BR /&gt;retain slastart 0;&lt;/P&gt;&lt;P&gt;/***start of sla request***/&lt;BR /&gt;day=sum(date(),1);&lt;BR /&gt;time=time();&lt;/P&gt;&lt;P&gt;/***ending the sla****/&lt;BR /&gt;enddate=sum(day,3);&lt;BR /&gt;endtime=time();&lt;BR /&gt;slastrdt=dhms(day,0,0,time);&lt;BR /&gt;slaenddt=dhms(enddate,0,0,time);&lt;/P&gt;&lt;P&gt;/***************WEEK DAY Processing***************/&lt;BR /&gt;weekdy=weekday(day);&lt;BR /&gt; if weekdy ge 2 and weekdy le 6 then &lt;BR /&gt;&amp;nbsp;&amp;nbsp; dtdiff=intck('day',day,sum(day,1));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if weekdy in (1,7) then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; select(weekdy);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when(1) if weekday(enddate) not in (1,7) then do;&lt;BR /&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtdiff=intck('day',day,sum(day,1))-1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; when(7) if weekday(enddate) not in (1,7) then do;&lt;BR /&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtdiff=intck('day',day,sum(day,1))-2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; otherwise put "error occured";&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt; end;&lt;BR /&gt;/***************WEEK DAY Processing***************/&lt;BR /&gt;hrstr=min(max(hour(slastrdt),9),16);&lt;BR /&gt;hrend=min(max(hour(slaenddt),9),16);&lt;BR /&gt;/****please change this*****/&lt;BR /&gt;dtdiff=intck('day',day,sum(day,1));&lt;BR /&gt;/****************************/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select(hrstr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(9)&amp;nbsp;&amp;nbsp; hrstr=7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(10) hrstr=6;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(11) hrstr=5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(12) hrstr=4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(13) hrstr=3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(14) hrstr=2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(15) hrstr=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(16) hrstr=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; otherwise put"error occured";&lt;BR /&gt;end;&lt;BR /&gt;select(hrend);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(9)&amp;nbsp;&amp;nbsp; hrend=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(10) hrend=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(11) hrend=2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(12) hrend=3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(13) hrend=4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(14) hrend=5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(15) hrend=6;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when(16) hrend=7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; otherwise put"error occured";&lt;BR /&gt;end;&lt;BR /&gt;if dtdiff eq 1 then sla=sum(hrstr,hrend);&lt;BR /&gt;else if dtdiff ge 2 then sla=sum(hrstr,hrend,(dtdiff-1)*7);&lt;/P&gt;&lt;P&gt;put sla=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2014 07:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/intck-hours-how-to-exclude-certain-time-and-day/m-p/151554#M39906</guid>
      <dc:creator>Imroze</dc:creator>
      <dc:date>2014-01-28T07:12:06Z</dc:date>
    </item>
  </channel>
</rss>

