The only tricky part of this process is getting the denominator for each by group and making that available to your unsummarised data. Since you are working with "by groups", then I'll assume your data are already ordered in group sequence. If it isn't, then sort the data first.
Then summarise the data so you get frequencies for each group. The Freq procedure is best for this approach and code like the following should suffice.
Proc Freq Data = SERVICES;
By DRG / Output Out = DRGFREQ;
Now match merge your two tables using the DRG key. There will be a column called COUNT, which is the frequency of each DRG group. You can rename this on merging if a column of the same name already exists on your unsummarised data.
Now split your data with code like the following:
If First.DRG Then GROUPFREQ = 0;
GROUPFREQ ++ 1;
If GROUPFREQ / COUNT <= 0.8 Then Output TOP80;
Else Output LAST20;
I don't have a sample of your data, or a structure so the code above is provided as an example only.