How many records?
I might start just to see:
Proc surveyselect data=have (where=(balance=50)) out=selected sampsize=1
;
run;
to see if you happen to have one or more records with a balance of 50. This matches your stated requirement to select records that have a balance total to 50. If this returns a record I quit with your requirements.
I have a strong suspicion that there is/ are other requirements/restrictions not stated.
I still say provide some actual example data and one or more possible results that you can create looking at the data manually.
This is possibly one way to get sets of two records that sum to 50 and then select one (or more) from those at random.
proc sql;
create table as twos as
select a.id,a.balance, b.id as id2, b.balance as balance2
from have as a, have as b
where a.balance + b.balance=50
;
run;
proc surveyselect data=twos out=selecttwos
sampsize=1;
run;
Extensible to 3, 4, 5 ... values, though it starts getting cumbersome.
Generally best practice before saying "select at random" is to clearly define the selection space and you have not done that very well because your values might take 500 values to get your target value since you have not provided any reasonable example data to work with.
... View more