谢谢各位大虾作者: shiyiming 时间: 2008-7-15 04:49 标题: Re: 求助:怎样对列求和? Try this code. It creates a csv file in "c\:";
[code:2hf4v2qf]data one;
input id $ n @@;
cards;
a 3
b 5
a 2
b 4
;
run;
proc print; run;
ods csv file='c:\table.csv';
proc means data=one sum;
class id;
run;
ods csv close;
[/code:2hf4v2qf]
Hope this helps.
YZ作者: shiyiming 时间: 2008-7-15 05:33 标题: Re: 求助:怎样对列求和? 对的对的,这个就是我想要的。谢谢大虾!作者: shiyiming 时间: 2008-7-15 12:05 标题: Re: 求助:怎样对列求和? 对于那些proc步生成的结果可以用ods命令改变默认的输出方式,建议看看ods帮助。
对于此问题,你也可以用data歩或者proc sql实现。作者: shiyiming 时间: 2008-7-25 17:09 标题: Re: 求助:怎样对列求和? 很简单嘛 <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
data one;
input x$ y;
cards;
a 3
b 5
a 2
b 4
run;
proc sort data=one;
by x;
data two;
set one;
by x;
retain total 0;
if first.x then total=0;
total=total+y;
if last.x ;
run;
proc print data=two;
run作者: shiyiming 时间: 2011-3-24 09:35 标题: Re: 求助:怎样对列求和? 最后那个只用数据步的很好,谢谢,那个正是我想要的。
就是那段code我有点不明白 first.x代表什么阿作者: Qiong 时间: 2011-3-24 11:01 标题: Re: 求助:怎样对列求和? first.x
判断是否是第一个x,if yes,计数器清零重新求和