|
楼主

楼主 |
发表于 2006-11-25 15:06:45
|
只看该作者
谁能帮忙看一下这段GCP中多中心临床实验产生随机数字的代码?
我下载了“随机表生成程序”中的SAS代码http://www.crinfo.cn/down/show.asp?id=18&type=1,但是输入sas中无法使用,不知何故。
本人对sas不是很熟悉,我改了一些数据group=2,Ratio=1:1,block=6,total=144,outset=out,seed=254734,以下是我改后的代码,可是还是不能用。谁能帮忙解释一下。谢谢。
%Macro mPlan(group=2,Ratio=1:1,block=6,total=144,outset=out,seed=254734);
%if %length(%cmpres(&group))=0 %then %let group=2;
%if %length(%cmpres(&ratio))=0 %then %let ratio=1:1;
%if %length(%cmpres(&block))=0 %then %let block=6;
%if %length(%cmpres(&total))=0 %then %let total=144;
%if %length(%cmpres(&OutSet))=0 %then %let OutSet=out;
%if %length(%cmpres(&seed))=0 %then %let seed=254734;
%let tRatio=0;
%do i=1 %to &group;
%let Ratio&i=%scan(&Ratio,&i,;
%let tRatio=%eval(&tRatio+&&Ratio&i);
%end;
%if %sysfunc(mod(&block,&tRatio)) ne 0 %then %do;
%put ERROR: Either Parameter BLOCK or RATIO is assigned wrong,macro Stopped!;
%goto TheEnd;
%end;
proc plan seed=&seed ;
factors Serial=%eval(&total/&block)
ordered block=&block ordered / noprint;
treatments treat=█
output out=&outset(drop=block serial) treat
cvals=( %do i=1 %to %eval(&block/&tRatio);
%do j=1 %to &group;
%do k=1 %to &&ratio&j; "%sysfunc(byte(&j+64))" %end ;
%end;
%end;;
run;
data &outset;
format patient best.;
set &outset;
patient=_N_;
run; |
|