由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Pharmacy版 - a question about SAS (转载)
相关主题
SAS clinical training请帮忙看3道SAS题。
Clinical SAS training will start soon!SAS help
Last reminder: SAS clinical training will start in a week!一道ADV 130 题目
制药行业统计分析招聘请问SAS advanced macro global 和local
The SAS clinical training will start soon!SAS ADVANCED 一道题求助
Free Clinical SAS training will start soon!求助,SAS ADV 130 中94
a question about SAS (转载)proc iml help!
a question about SAS一个常见的问题
相关话题的讨论汇总
话题: mudaa话题: mudbb话题: dq话题: mudab话题: de
进入Pharmacy版参与讨论
1 (共1页)
w*****1
发帖数: 473
1
【 以下文字转载自 Statistics 讨论区 】
发信人: wz99331 (dotti), 信区: Statistics
标 题: a question about SAS
发信站: BBS 未名空间站 (Mon Apr 2 12:52:18 2012, 美东)
我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std will be used as grid search ranges */
%macro loops;
proc means data=parents;
var QTP;
output out=range min=min max=max std=std mean=mean;
run;
proc print data=range;
run;
data temp; set range;
%do e=1 %to 10;
de=e*std/10;
%do q=1 %to 10;
dq=(q-1)*0.1;
%do i=1 %to 21;
mudaa=min+(i-1)*(max-min)/20;
%do j=1 %to 21;
mudab=min+(j-1)*(max-min)/20;
%do k=1 %to 21;
mudbb=min+(k-1)*(max-min)/20;
output;
data _NULL_;
set two;
call symput("mudaa", mudaa);
call symput("mudab", mubab);
call symput("mudbb", mudbb);
call symput("de", de);
call symput("dq", dq);
run;
%put mudaa=&mudaa mudab=&mudab mudbb=&mudbb de=&de dq=&dq;
%end;
%end;
%end;
%end;
%end;
run;
%mend;
%loops;
%macro new(mudaa=, mudab=, mudbb=, de=, dq=, indata=, outdata=);
data &outdata; set &indata;
lnl=log((((1-&dq)**2)*(1/sqrt(2*constant('PI')*&de))*exp(-0.5*(((QTP-mudaa)/
&de)**2))+
2*&dq*(1-&dq)*(1/sqrt(2*constant('PI')*&de))*exp(-0.5*(((QTP-mudaa)/&
de)**2))+
(&dq**2)*(1/sqrt(2*constant('PI')*&de))*exp(-0.5*(((QTP-mudaa)/&de)**2
))));
run;
proc means data=&outdata sum;
var lnl;
output out=lnnew sum=sum;
run;
%mend new;
%new(mudaa=-0.6, mudab=0.0, mudbb=0.8, de=0.1, dq=0.4,
indata=parents, outdata=Sgridsearch);
%new(mudaa=&mudaa, mudab=&mudab, mudbb=&mudbb, de=&de, dq=&dq,
indata=temp, outdata=gridsearch);
proc sort data=gridsearch;
by descending lnlikelihood;
output out=grid_sort_search;
data grid_search; set grid_sort_search;
if(_N_ =1);
proc print data=grid_search noobs;
1 (共1页)
进入Pharmacy版参与讨论
相关主题
一个常见的问题The SAS clinical training will start soon!
Need advice on SAS macro debuggingFree Clinical SAS training will start soon!
[合集] 一个sas问题a question about SAS (转载)
问个SAS题目,a question about SAS
SAS clinical training请帮忙看3道SAS题。
Clinical SAS training will start soon!SAS help
Last reminder: SAS clinical training will start in a week!一道ADV 130 题目
制药行业统计分析招聘请问SAS advanced macro global 和local
相关话题的讨论汇总
话题: mudaa话题: mudbb话题: dq话题: mudab话题: de