input a $ b;
cards;
a 1
b 2
c 3
d 4
;
run;
我想添加一列,新的一列是b 的各个观测值占该列总和的比。谢谢!

|
楼主: waitalone11
|
11405
10
[原创博文] 求助 如何增加一列 |
|
博士生 88%
-
|
回帖推荐But you will have to read twice, one for calculating a total and the other for calculating a percent.
Here it is. This sort of programming style is posted several times.There are some good knowledge points here.
data a;
input a $ b;
cards;
a 1
b 2
c 3
d 4
;
run;
data b;
do _n_=1 to nobs;
set a nobs=nobs;
tot_b+b;
end;
do _n_=1 to nobs;
se ...
本帖被以下文库推荐
| ||
|
|
| ||
|
力拔山兮气盖世,时不利兮锥不逝
|
|
| ||
|
| ||
| ||
| ||
| ||
| ||
加好友,备注cda京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


