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.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 506 views
  • 0 likes
  • 3 in conversation