I don't know if this is really all that more direct than Arthur's solution but it has fewer lines of code... data havea; set have; array mn(24) month1-month24; array nm(24) _TEMPORARY_; array sb(24) _TEMPORARY_; array lg(24) _TEMPORARY_; do i = 1 to 24; nm(i) = 0; if mn(i) = 1 then sb(i) = 1; else sb(i) = 0; if mn(i) = 1 and i = 1 then nm(i) = 1; else if sb(i) = 1 then nm(i) = (sb(i)) + (nm(i-1)); else nm(i) = 0; end; long = max(of nm ); do j = 1 to 24; if nm(j) = long then lg(j) = 1; else lg(j) = 0; times = sum(of lg ); end; run;
... View more