楼主: Firefly01
6787 15

SAS程序计算成绩 [推广有奖]

11
crackman 发表于 2010-5-26 19:50:02
为什么会这样呢?

12
sushe1527 发表于 2010-5-26 19:58:00
crackman 发表于 2010-5-26 19:50
为什么会这样呢?
total算重复了,本来是5x+5x的大小,后来是avg平均按照6x分的,所以偏大比例为 10/6
那么换算回来就是乘以  6/10=3/5 就好了

13
823954913 发表于 2010-5-26 20:55:08
data score;
input name$ sex$ chinese math physics chemistry english;
label name="姓名" sex="性别" chinese="语文" math="数学" physics="物理" chemistry="化学" english="英语";
total=sum(of _numeric_);
avg=total/5;
format avg f8.2;
if math>85;
cards;
王辉   男    80    85    82    78    90
李唱   女    85    93    88    70    89
张三   男    77    86    67    82    85
王二   女    81    78    93    83    87
;
run;
这个多简单多明白。

14
sopching 发表于 2010-5-27 00:15:21
咋一看还真没看出来 ,sushe一句话点醒了我。 厉害!

15
chenjung0825 发表于 2010-5-27 11:00:08
data score;
input name$ sex$ chinese math physics chemistry english;
label name="姓名" sex="性别" chinese="语文" math="数学" physics="物理" chemistry="化学" english="英语";
if math>85;
total=sum(of _numeric_);
avg=total/5;
format avg f8.2;
cards;
王辉   男    80    85    82    78    90
李唱   女    85    93    88    70    89
张三   男    77    86    67    82    85
王二   女    81    78    93    83    87
;
run;

16
shadowpei 发表于 2011-4-16 20:10:21
data score11;
input name$ sex$ chinese math physics chemistry english;
label name="姓名" sex="性别" chinese="语文" math="数学" physics="物理" chemistry="化学" english="英语";
sum = chinese +math + physics+ chemistry +english;
avg = (chinese +math + physics+ chemistry +english)/3;
format avg f8.2;
if math>85;
cards;
王辉   男    80    85    82    78    90
李唱   女    85    93    88    70    89
张三   男    77    86    67    82    85
王二   女    81    78    93    83    87
;
run;

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-22 07:39