|
楼主: inertialife
|
4708
4
[SAS] 特定条件加总数据 |
|
本科生 82%
-
|
回帖推荐以下是引用SignPingGu在2008-8-2 22:38:00的发言:Assume you have created the new dataset ttt with new variable yeara, the following code will solve your problem:proc sort data = ttt; by business yeara;proc means NOPRINT data = ttt; Class business yeara; var proceeds; output out = new1 sum = sumproceeds;run;The ...
SignPingGu 发表于3楼 查看完整内容 echotianxia's solution looks great. ButYou can also try the SAS procedures - means, summary, or univariateThe following is the example code for Proc meansdata = temp; class business datea; var proceeds; output out = tt sum = sumproceeds;run;Note: you probably need to create variable yeara = year (date) and sort the dataset by business and yeara.Hope it helps !
echotianxia 发表于2楼 查看完整内容 data pinggu;infile'd:\sas\sas\pinggu.txt';input date ddmmyy10. company&$ proceeds;format date ddmmyy10.;run;proc sort data=pinggu;by company;run;data pinggunew;set pinggu;by company;if missing(company) then delete;if first.company then a=proceeds;if last.company then do;a=a+proceeds;output;retain a 0;end;drop a;run;proc print data=pinggunew;run;你可以把路径改一下,我测出了结果的,不过就只有这五个 ...
本帖被以下文库推荐
| ||
|
|
| ||
| ||
| ||
京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明
用户协议


