[英]Weighted Rank in SAS
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]我有一张表格,其中 R60、R90、R120、R150、R180 的分数不同,我如何根据这五个变量制作一张具有加权排名的表格,以及 CODE_RAC ,其中 NORM_PCT 的权重为 40%,RB_PCT 的权重为 30%,RB_PCT有 40% 的权重 ][1]
Can you help me with this in SAS Enterprise Edition?您能在 SAS Enterprise Edition 中帮助我吗? Please find the sample attached from the dataset请从数据集中找到附加的样本
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.应该有一个 proc rank 程序,它可以为您进行排名。 Either that or you can just sort the data by calculated 'ranking variable (rank_calc in example).或者你可以通过计算的'排名变量(例如 rank_calc )对数据进行排序。 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有关排名的更多信息,请参阅http://www.lexjansen.com/nesug/nesug09/ap/AP01.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.