Can you post an example to explain this question ?
data have;
set sashelp.cars(keep=make model invoice);
run;
proc sql noprint;
select int(count(distinct make)*0.1) as n,
0.09*sum(invoice) as low,
0.11*sum(invoice)
into :n,: low,: high
from have;
quit;
proc iml;
use have;
read all var{make model invoice};
close;
found=0;
key=unique(make);
do until(found);
temp=sample(key,&n,'wor');
idx=loc(element(make,temp));
sum=sum(invoice[idx]);
if &low < sum & sum < &high then do;
found=1;print "Found:" "&low" sum[l=''] "&high";
end;
end;
_make=make[idx];_model=model[idx];_invoice=invoice[idx];
create want var{_make _model _invoice};
append;
close;
quit;
... View more