BookmarkSubscribeRSS Feed
keiwo
Obsidian | Level 7

Greetings,

 

Hope everyone is doing well.

 

Below is an example of an output from SAS MA export node

 

CUSTOMER_ID Scoring_Var1 Scoring_Var2 Scoring_Var3
CUST0000001 0.98765 0.01234 0.99999

 

Question: is there a way to create a calculated field that will return the max(Scoring_Var)  for each row.

 

Thanks in advance 😁

2 REPLIES 2
mklangley
Lapis Lazuli | Level 10

Here's one way, using an array, that is suitable for any number of scoring_var# columns you have.

data have;
    input customer_id $12. scoring_var1 scoring_var2 scoring_var3;
    datalines;
CUST0000001 0.98765 0.01234 0.99999
CUST0000002 0.87654 0.76543 0.54321
    ;
run;

data want;
    set have;
    array scoring_columns scoring_var:;
    max = max(of scoring_columns[*]);
run;

 For more details, or to see a few other methods, see this link.

JamesAnderson
SAS Employee

Perhaps LARGEST() is the SQL function that would do this for you (although you will need to confirm its available in CI Studio). In a calculated item create an expression like: LARGEST(1, Scoring_Var1, Scoring_Var2, Scoring_Var3)

 

Regards

James

How to improve email deliverability

SAS' Peter Ansbacher shows you how to use the dashboard in SAS Customer Intelligence 360 for better results.

Find more tutorials on the SAS Users YouTube channel.

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