Hi hellind As the requirement seems to be a support based do you guys work on weekends and holidays. Or else we can include few conditions like weekday() for discarding weekends support. Please find the updated code below... hope it helps data _null_; length x $20.; retain slastart 0; /***start of sla request***/ day=sum(date(),1); time=time(); /***ending the sla****/ enddate=sum(day,3); endtime=time(); slastrdt=dhms(day,0,0,time); slaenddt=dhms(enddate,0,0,time); /***************WEEK DAY Processing***************/ weekdy=weekday(day); if weekdy ge 2 and weekdy le 6 then dtdiff=intck('day',day,sum(day,1)); else if weekdy in (1,7) then do; select(weekdy); when(1) if weekday(enddate) not in (1,7) then do; dtdiff=intck('day',day,sum(day,1))-1; end; when(7) if weekday(enddate) not in (1,7) then do; dtdiff=intck('day',day,sum(day,1))-2; end; otherwise put "error occured"; end; end; /***************WEEK DAY Processing***************/ hrstr=min(max(hour(slastrdt),9),16); hrend=min(max(hour(slaenddt),9),16); /****please change this*****/ dtdiff=intck('day',day,sum(day,1)); /****************************/ select(hrstr); when(9) hrstr=7; when(10) hrstr=6; when(11) hrstr=5; when(12) hrstr=4; when(13) hrstr=3; when(14) hrstr=2; when(15) hrstr=1; when(16) hrstr=0; otherwise put"error occured"; end; select(hrend); when(9) hrend=0; when(10) hrend=1; when(11) hrend=2; when(12) hrend=3; when(13) hrend=4; when(14) hrend=5; when(15) hrend=6; when(16) hrend=7; otherwise put"error occured"; end; if dtdiff eq 1 then sla=sum(hrstr,hrend); else if dtdiff ge 2 then sla=sum(hrstr,hrend,(dtdiff-1)*7); put sla=; run; Thank You
... View more