@Gil_
If I understand right what you're after then below code should do the job.
data have;
infile datalines truncover;
input dttm datetime.;
format dttm datetime21.;
datalines;
08Aug2016 21:59:59
08Aug2016 22:00:00
08Aug2016 22:00:01
08Aug2016 23:59:59
09Aug2016 00:00:00
09Aug2016 00:00:01
09Aug2016 07:59:59
09Aug2016 08:00:00
09Aug2016 08:00:01
;
run;
data want;
set have;
format dttm_work datetime21.;
dttm_work=ifn(hour(intnx('dthour',dttm,2,'s'))<10,
intnx('dthour',intnx('dtday',intnx('dthour',dttm,2,'s'),0,'b'),8,'s'),
dttm
);
run;
proc print data=want;
run;
... View more