I think you are asking to insert a series of model statements into your PROC LOGISTIC step. The following untested macro allows you to build as many MODEL statements as you need (the default is 10 and the macro call requests 25).
proc logistic data=mydata descending;
%do i = 1 %to ⊧
rs&i: model y = rs&i a b c d;
I think your macro probably works but PROC LOGISTIC does not allow multiple model statements like PROC REG. V 9.1.3 anyway.
421 proc logistic data=sashelp.class descending;
422 weight: model sex = weight;
423 height: model sex = height;
ERROR: Only one MODEL statement can be used with each invocation of PROC LOGISTIC.
I find that for a situation that the OP describes it is more satisfying to fiddle with the data and use a BY statement than to fiddle with macros.
do _n_ = 1 to dim(rs);
rs[_n_] = ranuni(123);
proc transpose data=class out=tclass;
by name sex age weight height;
order = input(substr(_name_,3),8.);
proc sort data=tclass;
proc logistic data=tclass;
by _name_ notsorted;
model sex = col1 age weight height;
You don't have to create the ORDER variable but without it RS1 is followed by RS10 and you probably prefer RS2 to follow RS1.
I guess I have a trouble with Ods Ouput now, the macro for LR works.
I used the similar ods output to collect pvalues in the PHREG statement and it was totally fine, but now I am given the error message that the variable 'Parameter' has never been referenced. Also I am getting this WARNING: Duplicate data set name on ODS OUTPUT statement. Entry will be ignored.
here is my program:
%DO I=1 %TO x;
ods output ParameterEstimates=Results;
DATA a; SET b; df=d*f; RUN;
proc logistic descending data=a;
MODEL y=d f df e.. ;
ods OUTPUT close;
DATA Estimate; SET Results; WHERE Parameter="df"; KEEP Parameter
ProbChiSq ; RUN;
DATA PVALUE; SET PVALUE Estimate; RUN;