set temp;
by group;
if first.group and last.group then output single;
else output dup;
run;
/**************************************************
We may also want to do data set processing within
each by group. In this example we construct the
cumulative sum of the variable X within each group.
**************************************************/
data cusum(keep=group sum);
set temp;
by group;
if first.group then sum=0;
sum+x;
if last.group then output;
run;
proc print data=cusum noobs;
title 'Sum of X within each group';
run;
Sum of X within each group 08:30 Wednesday, May 23, 2012 7
group sum
1 102
2 414
3 31
4 35
Equivalent coding:
/**************************************************
As an aside, if you simply want the sum of X within
each group, one of the many way of obtaining this
is with PROC PRINT.
**************************************************/
proc print data=temp;
title 'All data with X summed within each group';
by group;
sum x;
sumby group;
run;
proc means data=temp sum;
by group;
run;
All data with X summed within each group 8
08:30 Wednesday, May 23, 2012
-------------------------------------------- group=1 ---------------------------------------------
Obs x
1 23
2 34
3 .
4 45
----- ---
Sas Crackman practice sas认证70题详解_计算机软件及应用_IT/计算机_专业资料 暂无评价0人阅读0次下载举报文档 Sas Crackman practice sas认证70题详解_计算机...
SAS认证70题_IT认证_资格考试/认证_教育专区。Exam Name: Exam Type: Exam ... Sas_Crackman_practice_... 134页 免费 SAS base 123 训练题 免... 56...
SAS_base_考试必备_70真题(附答案)_其它考试_资格考试/认证_教育专区。SAS 基础考试必备 考题及答案SAS BASE 考试必备 70 题并附答案 1.The following SAS ...
2014经济师初级《金融专业与实务》真题及答案解析64-70题_财会/金融考试_资格考试/认证_教育专区。2014经济师考试初级《金融专业与实务》真题及答案,由经济师考试...
SAS base 考试必备 70真题(附答案)_IT认证_资格考试/认证_教育专区。考SAS初级程序员的同学可以在冲刺阶段做的真题,是2008年的考题。...
2014年初级经济师考试经济基础知识真题答案解析【64-70题】_财会/金融考试_资格考试/认证_教育专区。2014经济师考试结束后,中华会计网校经济师频道第一时间为大家...
招投标选择题详解及练习70题_其它考试_资格考试/认证_教育专区。一、单项选择题 1.下列施工项目不属于必须招标范围的是( )。 A.大型基础设施项目 B.使用世界...
sas初级考试必看70题_计算机软件及应用_IT/计算机_专业资料。sas初级考试必看70... Sas Crackman practice ... 134页 1下载券 SAS认证70题 暂无评价 31页 ...
2013年最新PMP模拟试题61-70题_从业资格考试_资格考试/认证_教育专区。61.项目进行到一半时,客户想取消剩余的工作和合同。最佳的方法是查看下列哪项来确定项目...
最新微软70-680认证考题赏析 凡具有 DOS、Windows 和一定英语水平的在职人员、各大专院校在校学生及要求获得网络技术知 微软认证。学习本专业者需有一定计算机基础和...
热门文档