Is this a homework assignment? Because this thread works on almost the exact same data and the exact same variable names.
https://communities.sas.com/t5/Base-SAS-Programming/How-to-filter-a-dataset-with-an-IF-condition/m-p/478211#M123291
But, you don't need macros to do this. Assign a random number to each group, sort and then take the top 5 (or top 10, or top 20) etc to randomly select.
... View more
And you are still ignoring what I posted.
"Volusia" form here:
else if _n_ in (13,14,15,16,17,18) then District = 'Volusia';
is not the same as "volusia":
where district = 'volusia';
So you do not get any observations.
... View more