楼主: zhangslash
1823 0

SAS来计算列的均值 [推广有奖]

  • 1关注
  • 1粉丝

初中生

71%

还不是VIP/贵宾

-

威望
0
论坛币
24 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
103 点
帖子
13
精华
0
在线时间
20 小时
注册时间
2005-3-2
最后登录
2019-3-6

楼主
zhangslash 发表于 2012-2-24 18:53:30 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
Suppose we are going to compute the expected revenue for subjects in first price private value auction (

EP_FPPA

). To calculate it, we need to compare the subject's bid (b8_1, b8_2, b8_3) with the average of other's bid (meanb8_1, meanb8_2, meanb8_3). The tip is from http://scott.sherrillmix.com/blog/programmer/sas-macros/

Here I extend to the case of three variables.


/*---------Example---------*/

proc means data=label.FPPA mean;/*test of the macro*/
var b8_1 b8_2 b8_3;
output out=label.lablemeanb8_1 mean=meanb8_1 meanb8_2 meanb8_3;
run;

data _null_;
set label.lablemeanb8_1;
call symput('meanbid8_1',trim(left(meanb8_1)));
call symput('meanbid8_2',trim(left(meanb8_2)));
call symput('meanbid8_3',trim(left(meanb8_3)));
run;

data label.FPPA;
set label.FPPA;
if b8_1> &meanbid8_1 then EP_FPPA1=b8_4- b8_1; else EP_FPPA1=0;
/*&meanbid8_1 is to call the value restored*/
if b8_2> &meanbid8_2 then EP_FPPA1=b8_5- b8_2; else EP_FPPA1=0;
if b8_3> &meanbid8_3 then EP_FPPA1=b8_6- b8_3; else EP_FPPA1=0;
run;

二维码

扫码加我 拉你入群

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

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

关键词:Programmer calculate Variables Programme Variable 计算

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

本版微信群
扫码
拉您进交流群
GMT+8, 2026-1-22 05:10