Rules? Data?
I would guess that Step 2 is summing the variable OS from the data coming from step 1 grouped by CIF and segment. And then some sequence is assigned within the CIF variable.
The summing part, if that is indeed part of the process is easy:
Proc summary data=have nway;
class cif segment2;
var OS;
output out=temp(drop= _type_ _freq_) sum=;
run;
then maype
Proc sort data=temp;
by segment2 descending os;
run;
data want;
set temp;
by segment2;
if first.segment2 then Computedcolumn=1;
else computedcolumn+1;
run;
You will likely need other sorts to get any specific order.