data test;
do id=1 to 10;
do b=1 to 3;
a=int(ranuni(0)*10);
output;
end;
end;
run;
proc sort data=test;
by id a;
run;
data _null_;
set test;
by id a;
length code $1000;
if first.a then code= "data "||catx("_","ds",id,a)||";"
|| "set test;"
||cat("where id=", cats(id), " and a=", cats(a),";")
|| "run;";
call execute(code);
run;