全部版块 我的主页
论坛 提问 悬赏 求职 新闻 读书 功能一区 学习笔记1.0
1863 0
2012-02-24
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;

二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群