This is the entire code that someone wrote. It's just the shape function that doesn't make sense to me.
%macro averageAF (out, riskfactors, data);
proc logistic data=&data descending outdesign=_design_ outest=_model_ noprint; model &out = &riskfactors; run;
%let vars=1; %let names=; %do %while (%Qscan(&riskfactors,&vars) ne ); %let names=&&names %Qscan(&riskfactors,&vars); %let vars=%eval(&vars+1); %end; %let vars=%eval(&vars-1);
%put &names;
data _design_; set _design_; if nmiss(of &riskfactors)=0 and nmiss(of &out)=0; run;
data _indices_; drop i perms; array x (&vars) (1:&vars); perms=fact(&vars); /*vars=4 and perms=24*/ do i=1 to perms; call allperm(i, of x(*)); output; end; run;
proc iml; use _design_; read all var {intercept &riskfactors} into X; close _design_; use _model_; read var {intercept &riskfactors} into beta; close _model_; use _indices_; read all var _num_ into indices; close _indices_;
start pp(pcases,X,beta); pcases=sum(1/(1+exp(-X*beta`))); finish;
run pp(pcases,X,beta);
print (pcases);
pred_cases_m=shape(.,nrow(indices),&vars); /*24 rows , 4 columns*/ prev_cases_m=shape(.,nrow(indices),&vars); /*24 rows , 4 columns*/
X1=X; do i=1 to nrow(indices); /*24*/ do k=1 to &vars; /*4*/ print (indices[i,k]); X[,indices[i,k]+1]=shape(0,nrow(X1),1); pred_cases_m[i,k]=sum(1/(1+exp(-X*beta`))); print (pred_cases_m[i,k]); end; X=X1; end;
... View more