OK. I just terminate the procedures and now am able to post some code so that you can help to solve the problem. ] %macro samplingconti_srs; %do CI = &ncistart %to &nci; %do sample = 1 %to &nsample; proc surveyselect data=logireg method=srs seed=&sample.&ci n=&size out=sp_&sample; run; data sp_&sample; set sp_&sample; n_sample = &sample; run; %end; data cov&covmatrix.size&size.CI&CI; set sp_1 - sp_&nsample; n_CI = &CI; run; %end; data disser.conti_cov&covmatrix.size&size._srs&ncistart._&nci; set cov&covmatrix.size&size.CI&ncistart - cov&covmatrix.size&size.CI&nci; run; proc sort data=disser.conti_cov&covmatrix.size&size._srs&ncistart._&nci; by n_CI n_sample; run; %mend samplingconti_srs; %macro modelmerge; data modelfit; set mdfitx1x2x3x4 mdfitx1x2x3 mdfitx1x2x4 mdfitx1x3x4 mdfitx2x3x4 mdfitx1x2 mdfitx1x3 mdfitx1x4 mdfitx2x3 mdfitx2x4 mdfitx3x4 mdfitx1 mdfitx2 mdfitx3 mdfitx4 mdfit; run; %mend modelmerge; %macro DAModelFit_srs (p1, p2, p3, p4); /*add sample ID for sample data in order to locate mistake, if any*/
/*need 1000 samplings * sampling 1000 times for each sample to construct one percentile CI*/
proc logistic data=disser.conti_cov&covmatrix.size&size._srs&ncistart._&nci;
by n_CI n_sample;
model y(event="1")= &p1 &p2 &p3 &p4;
output out=a pred=yhat; /*for Tjur coefficient*/
ods output FitStatistics = LogLFits;/*create logl0 and loglm for McFadden*/
run;
proc ttest data=a; class y; var yhat; by n_CI n_sample; ods output conflimits=meand1; /*for Tjur coefficient*/ run; /*for Tjur coefficient*/
data modelfitMcF (keep = n_CI n_sample x1 x2 x3 x4 subset McFadden);
set Loglfits;
if Criterion = '-2 Log L';
subset = "&p1&p2&p3&p4";
%do i =1 %to 4;
if "&&p&i"="x&i" then x&i=1; else x&i=0;
%end;
** to obtain Likelihoods from -2 log Likelihoods;
LogL0 = InterceptOnly/-2;
LogLM = InterceptAndCovariates/-2;
L0 = exp(InterceptOnly/-2);
LM = exp(InterceptAndCovariates/-2);
McFadden = 1- (LogLM/LogL0);
run;
data modelfitTjur (keep = n_CI n_sample x1 x2 x3 x4 subset Tjur);
set meand1;
if method = "Pooled";
Tjur = abs(Mean);
*subset = "&&modelRhs&i";
subset = "&p1&p2&p3&p4";
%do i =1 %to 4;
if "&&p&i"="x&i" then x&i=1; else x&i=0;
%end;
run;
data mdfit&p1&p2&p3&p4;
merge modelfitMcF modelfitTjur;
by subset;
run;
%mend DAModelFit_srs;
%macro GDmeasure_sp(spmethod); data disser.conti_GDmscov&covmatrix.size&size.__&spmethod&ncistart._&nci; merge GD_x1 GD_x2 GD_x3 GD_x4; by n_CI n_sample variable; D12 = GD_x1 - GD_x2; D13 = GD_x1 - GD_x3; D14 = GD_x1 - GD_x4; D23 = GD_x2 - GD_x3; D24 = GD_x2 - GD_x4; D34 = GD_x3 - GD_x4; R12 = GD_x1 / GD_x2; R13 = GD_x1 / GD_x3; R14 = GD_x1 / GD_x4; R23 = GD_x2 / GD_x3; R24 = GD_x2 / GD_x4; R34 = GD_x3 / GD_x4; run; %mend GDmeasure_sp;
%macro predictorGD_sp(predictor=, rest=);
data full&predictor (keep=n_CI n_sample subset &predictor &rest McFfull_&predictor Tjurfull_&predictor);
set modelfit (rename=(McFadden=McFfull_&predictor Tjur=Tjurfull_&predictor));
where &predictor=1;
run;
data sub&predictor (keep=n_CI n_sample subset &predictor &rest McFsub_&predictor Tjursub_&predictor);
set modelfit (rename=(McFadden=McFsub_&predictor Tjur=Tjursub_&predictor));
where &predictor=0;
run;
/* proc sort data=full&predictor; by descending x2 descending x3 descending x4; run;*/
/* proc sort data=sub&predictor; by descending x2 descending x3 descending x4; run;*/
proc sort data=full&predictor; by &rest; run;
proc sort data=sub&predictor; by &rest; run;
data add_&predictor;
merge full&predictor sub&predictor;
by &rest;
McFGD = McFfull_&predictor - McFsub_&predictor;
TjurGD = Tjurfull_&predictor - Tjursub_&predictor;
keep n_CI n_sample &rest McFfull_&predictor McFsub_&predictor Tjurfull_&predictor Tjursub_&predictor McFGD TjurGD;
run;
proc sql; /*obtaining variable means by sql*/
create table GD_&predictor as
select n_CI, n_sample, "McFGD" as Variable, avg(McFGD) as GD_&predictor format 8.7
from add_&predictor
group by n_CI, n_sample
union
select n_CI, n_sample, "TjurGD" as Variable, avg(TjurGD) as GD_&predictor format 8.7
from add_&predictor
group by n_CI, n_sample;
quit;
%mend predictorGD_sp;
%macro stage_analysis_srs;
%do ncistart = &start %to &end %by &by;
%let nci = %eval(%eval(&ncistart) + %eval(&by)-1);
%samplingconti_srs;
proc datasets lib=work memtype=data nolist; delete a: cov: ful: gd: m: parent: sp: sub:; quit;
%DAModelFit_srs (x1, x2, x3, x4);
%DAModelFit_srs (x1, x2, x3, );
%DAModelFit_srs (x1, x2, , x4);
%DAModelFit_srs (x1, , x3, x4);
%DAModelFit_srs ( , x2, x3, x4);
%DAModelFit_srs (x1, x2, , );
%DAModelFit_srs (x1, , x3, );
%DAModelFit_srs (x1, , , x4);
%DAModelFit_srs ( , x2, x3, );
%DAModelFit_srs ( , x2, , x4);
%DAModelFit_srs ( , , x3, x4);
%DAModelFit_srs (x1, , , );
%DAModelFit_srs ( , x2, , );
%DAModelFit_srs ( , , x3, );
%DAModelFit_srs ( , , , x4);
%DAModelFit_srs ( , , , );
%modelmerge;
proc datasets lib=work memtype=data nolist; delete mdfit:; quit;
%predictorGD_sp(predictor=x1, rest=x2 x3 x4);
%predictorGD_sp(predictor=x2, rest=x1 x3 x4);
%predictorGD_sp(predictor=x3, rest=x1 x2 x4);
%predictorGD_sp(predictor=x4, rest=x1 x2 x3);
/*to obtain the dominance statistics to be analyzed*/
%GDmeasure_sp(srs);
%end;
%mend stage_analysis_srs; I put all the macros and the final macro wrapping up all the macros to run. (To run it, you need to simulate a population with x1 -x4 and y, and define some macro variables in the final macro). The TTEST procedure is only in one of the macros, where I underlined. However, now I find that it might not be a problem of any procedure but the space/ memory/(whatever you want to call it) thing. After I replace the TTEST, the procedures still ran slow, and got completely blocked at %predictorGD_sp(predictor=x1, rest=x2 x3 x4); A window jumped out saying something like "no space" (I cannot remember the exact wording) and provided several options : let the proedure know, cancel the submitted, terminate ... And I canceled. the log said: 712 %predictorGD_sp(predictor=x1, rest=x2 x3 x4); ERROR: Insufficient space in file WORK.FULLX1.DATA. ERROR: File WORK.FULLX1.DATA is damaged. I/O processing did not complete. ERROR: Sorted run creation failure. ERROR: Failure encountered while creating initial set of sorted runs. ERROR: Failure encountered during external sort. ERROR: User asked for termination. I am really confused at why this happened.
... View more