Try this new modified version of the code, I have added a different city, so you can see how the code would behave with different time intervals, and you should be able to take it from here.....
data have;
length state $2
city $10
fmtname $7
start 8
label $5
hour 4
minute 4;
input state city fmtname start :date9. label hour minute;
format start date9. label $5.;
datalines;
MD Baltimore sunrise 17Jan2017 07:24 7 24
MD Baltimore sunset 17Jan2017 17:10 17 10
DE Dover sunrise 13JUL2017 04:47 4 47
DE Dover sunset 13JUL2017 19:28 19 28
;
run;
data want(drop=i);
set have;
array hours {24} 4 hour_0-hour_23;
format hour_: BEST8.4;
/* Set all Hours to 0 */
do i=1 to dim(hours);
hours[i]=1;
end;
if (fmtname='sunrise') then
/* Assign the Subsequent Hours the factors (minutes/60) */
do i=(hour+2) to (12+hour-1);
hours[i]=minute/60;
end;
else if (fmtname='sunset') then
do;
/* Assign the Hours prior 8:00 am the factors (minutes/60) */
do i=8 to 1 by -1;
hours[i]=minute/60;
end;
/* Assign the Subsequent Hours the factors (minutes/60) */
do i=(hour+2) to dim(hours);
hours[i]=minute/60;
end;
end;
output;
run;