Is this what you want,
proc sql;
select distinct date,
case when dtime >=93000 and dtime<93100 then "p1 9:30:00 - 9:30:59"
when dtime >=93100 and dtime<93200 then "p2 9:31:00 - 9:31:59"
else "p3 others add here"
end as Time_period,
Tnumber,
count(Tnumber) as count
from test
group by date, Time_period, Tnumber;
quit;
output
date Time_period TNumber count
---------------------------------------------------
20070104 p1 9:30:00 - 9:30:59 0 2
20070104 p1 9:30:00 - 9:30:59 1 4
20070104 p1 9:30:00 - 9:30:59 2 4
20070105 p1 9:30:00 - 9:30:59 0 1
20070105 p1 9:30:00 - 9:30:59 2 1
20070105 p2 9:31:00 - 9:31:59 0 2
20070105 p2 9:31:00 - 9:31:59 1 6
20070105 p2 9:31:00 - 9:31:59 2 4
20070105 p3 others add here 0 1