I agree with Patrick, generating many datasets are not a good thing to do (it should be "neater" if you could process the dataset at once without splitting it), but here's an "ugly" (call execute) but simple way of doing it without the complexity of macro coding.
Assuming that Trip is ordered by PersonID and TripID:
data _null_;
set Trip;
retain _FIRSTOBS;
by PersonID TripID; /* assume that Trip is ordered */
if first.TripID then do; /* first pair */
_FIRSTOBS=_N_; /* hold the obs num */
_COMBNUM+1; /* count combination number */
end;
if last.TripID then do; /* last pair */
call execute('data COMB'!!cats(put(_COMBNUM,best.))!!
'; set x (firstobs='!!cats(put(_FIRSTOBS,best.))!!' obs = '!!cats(put(_N_,best.))!!'); run;'); /* slice the dataset with call execute call */
end;
run;
Caution, at the end you'll have many COMBx datasets (one per combination).
Greetings from Portugal.
Daniel Santos at
www.cgd.pt