BookmarkSubscribeRSS Feed
audreypingkan
Calcite | Level 5

I'm new in using SAS Enterprise Guide, 

 

I dont know the code for Step 2 (attachment below), Computed Column is a new Column that can;t be found in other tables. Example: Computed Column = 1 for highest OS for Commercial Segment of CIF 1. Computed Column = 2 for second highest for Corporate Segmment of CIF 1.

 

I really need your help.  Thank you.

2 REPLIES 2
Kurt_Bremser
Super User

Please supply your example data as data steps (see my footnotes for how to do that semi-automatically), so we can know your datasets (Maxim 3) as they are, and not how the ***** Excel thinks they are.

Then also post your code (once again, see my footnotes), so we can see what you already tried.

 

ballardw
Super User

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.