Unless I'm missing something, you're asking for something that SAS can do relatively easily:
data want;
set have;
by id value notsorted;
if first.value=0 or last.value=0;
run;
For the IDs you are looking for, it outputs multiple observations (not just one).
... View more