-1

I have a table with different scores for R60,R90,R120,R150,R180 and how can I make one table with a weighted rank based on this five variables, and CODE_RAC where NORM_PCT has 40% weightage, RB_PCT has 30% weightage and RB_PCT has 40% weightage ][1]

Can you help me with this in SAS Enterprise Edition? Please find the sample attached from the dataset

enter image description here

Robin Kanters
  • 5,018
  • 2
  • 20
  • 36
SUBHRA SANKHA
  • 118
  • 1
  • 2
  • 11
  • 1. Please post your sample data as text in your question. 2. What output do you expect for the sample data? 3. What have you tried so far? – user667489 Feb 13 '17 at 22:04

1 Answers1

0

This isn't done with enterprise edition, but I hope it would serve.

There should be a proc rank program, which does the ranking for you. Either that or you can just sort the data by calculated 'ranking variable (rank_calc in example). I'm quite sure you could do this in single step, but may this be more informative.

data Begin;
    length code_rac $10 norm_R60 3 rb_R60 3 Reso_R60 3;
    input code_rac norm_R60 rb_R60 Reso_R60;
    datalines;
    first 10 6 2
    second 0 0 10 
    third 8 6 4
    forth 0 10 7
    fifth 0 0 8 
    ;
ruN;

data begin; /*Calculate weighted value for ranking*/
    set begin;
    rank_calc= norm_R60*0.4 + rb_R60*0.3 + Reso_R60*0.4;
run;

proc rank data=begin out=sorted_by_rank; 
    var rank_calc;
    ranks my_rank; 
run; 

For more on ranking see http://www.lexjansen.com/nesug/nesug09/ap/AP01.pdf

pinegulf
  • 1,334
  • 13
  • 32
  • yes I did the same thing, DATA TAB_APRIL_CL1; SET TAB_APRIL_CL; POS_PCT = SUM(TOT_POS_R60/TOTAL_POS); format POS_PCT percent8.2; NEW_SCORE = SUM(NORM_PCT_R60_SCORE * .4 , RB_PCT_R60_SCORE * .3, RESO_PCT_R60_SCORE * .3); NEW_SCORE = POS_PCT * NEW_SCORE; NEW_SCORE = Round(NEW_SCORE); RUN; Thank you though! – SUBHRA SANKHA Feb 14 '17 at 07:43