楼主: 344109549
1254 2

请问这个程序怎么解释?谢谢! [推广有奖]

  • 0关注
  • 1粉丝

已卖:1份资源

讲师

44%

还不是VIP/贵宾

-

威望
0
论坛币
3958 个
通用积分
5.8660
学术水平
4 点
热心指数
7 点
信用等级
3 点
经验
2137 点
帖子
196
精华
0
在线时间
564 小时
注册时间
2014-6-22
最后登录
2025-12-22

楼主
344109549 发表于 2016-2-18 13:44:42 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
data score;                                                                                                                             
input id type $ score;                                                                                                                  
cards;                                                                                                                                 
1 math 87                                                                                                                              
1 chinese 79                                                                                                                           
2 math 98                                                                                                                              
3 math 90                                                                                                                              
2 chinese 85                                                                                                                           
;                                                                                                                                       
proc sort data=score;                                                                                                                  
by id; run;                                                                                                                             
data total;                                                                                                                             
set score;                                                                                                                              
by id;                                                                                                                                 
if first.id then total=0;                                                                                                               
total+score;                                                                                                                           
drop type pay;                                                                                                                          
if last.id then output;                                                                                                                 
proc print;                                                                                                                             
run;   
大神能不能解释一下data total;                                                                                                                             
set score;                                                                                                                              
by id;                                                                                                                                 
if first.id then total=0;                                                                                                               
total+score;                                                                                                                           
drop type pay;                                                                                                                          
if last.id then output;                                                                                                                 
proc print;                                                                                                                             
run;  各步的意思,最后得到的结果是: 程序结果

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Chinese output score Total outpu 程序

沙发
co_fund 发表于 2016-2-19 09:38:19
整体功能:按id汇总成绩
data total;                                                                                                            
set score;                                                                                                                              
by id;          *以上,略;                                                                                                                       
if first.id then total=0;  *某id 第一次出现,Total=0;                                                                                                            
total+score;   *total=total+Score;                                                                                                                        
drop type pay;                                                                                                                          
if last.id then output;  *某id最后一次出现,输出,即输出汇总的结果;                                                                                                               
proc print;                                                                                                                             
run;  

藤椅
344109549 发表于 2016-2-19 11:18:20
co_fund 发表于 2016-2-19 09:38
整体功能:按id汇总成绩
data total;                                                                  ...
明白了,多谢

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-3 11:51