Slightly different solution:
max_limit = 0;
min_balance = constant('big');
call missing(prod_max_limit, prod_min_balance);
end;
if limit > max_limit then do;
max_limit = limit;
prod_max_limit = prod;
end;
else do;
if limit = max_limit then do;
prod_max_limit = catx('&', prod_max_limit, prod);
end;
end;
if balance < min_balance then do;
min_balance = balance;
prod_min_balance = prod;
end;
else do;
if balance = min_balance then do;
prod_min_balance = catx('&', prod_min_balance, prod);
end;
end;
if last.cust_id then do;
output;
end;
run;
... View more