For each ID, read all the treatment>0 cases followed by all the without-treatment cases. Then just keep the first obs for each id and test its TREATMENT variable against 0.
data have;
input ID treatment;
datalines;
1 0
1 1
1 1
2 1
2 3
2 3
3 0
3 0
3 0
run;
data want (drop=treatment);
set have (where=(treatment>0)) have (where=(treatment=0));
by id;
if first.id;
trt_dummy=(treatment>0);
run;
This works if the data are already sorted by ID. But it doesn't matter what the order is within each ID.